23 lines
527 B
PHP
23 lines
527 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Directories;
|
|
|
|
use App\Contracts\Directories\CustomerDirectory;
|
|
use App\Models\Customer;
|
|
use Domain\Models\ValueObjects\Email;
|
|
use Ramsey\Uuid\UuidInterface;
|
|
|
|
class EloquentCustomerDirectory implements CustomerDirectory
|
|
{
|
|
public function find(UuidInterface $id): ?Customer
|
|
{
|
|
return Customer::find($id->toString());
|
|
}
|
|
|
|
public function getCustomerByEmail(Email $email): ?Customer
|
|
{
|
|
return Customer::where('email', $email->value)->first();
|
|
}
|
|
}
|