add email signup flow
This commit is contained in:
parent
9945163a2f
commit
3dc9204979
27 changed files with 629 additions and 24 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\User;
|
||||
|
||||
use App\Shared\ValueObject\EmailAddress;
|
||||
use DomainException;
|
||||
|
||||
class EloquentUserRepository implements UserRepository
|
||||
{
|
||||
|
|
@ -38,6 +39,22 @@ class EloquentUserRepository implements UserRepository
|
|||
return $this->toDomain($model);
|
||||
}
|
||||
|
||||
public function update(User $user): User
|
||||
{
|
||||
$model = UserModel::find($user->getId());
|
||||
if ($model === null) {
|
||||
throw new DomainException(
|
||||
"User with id {$user->getId()} not found",
|
||||
);
|
||||
}
|
||||
|
||||
$model->email = $user->getEmail()->value();
|
||||
$model->passwordHash = $user->getPasswordHash();
|
||||
$model->save();
|
||||
|
||||
return $this->toDomain($model);
|
||||
}
|
||||
|
||||
private function toDomain(UserModel $model): User
|
||||
{
|
||||
return new User(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue