<?php

namespace App\Services;

use Exception;
use App\Models\Address;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Auth;

class AddressService
{

    /**
     * @throws Exception
     */
    public function list()
    {
        try {
            return Address::where('user_id', Auth::user()->id)->first();
        } catch (Exception $exception) {
            Log::info($exception->getMessage());
            throw new Exception($exception->getMessage(), 422);
        }
    }
}