refactor: remoção de lógica de negócio duplicada.
This commit is contained in:
parent
dcb9d796d1
commit
875f856660
|
|
@ -10,7 +10,8 @@ class ClientService
|
|||
{
|
||||
|
||||
public function __construct(protected Client $client) {}
|
||||
public function addClient($client) {
|
||||
public function addClient(array $client)
|
||||
{
|
||||
return Client::create($client);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@ class UserService
|
|||
public function __construct(protected User $user) {}
|
||||
public function createUser(array $user)
|
||||
{
|
||||
if (User::where('email', '=', $user['email'])) {
|
||||
throw new \Exception('O e-mail já está cadastrado.');
|
||||
}
|
||||
|
||||
return User::create($user);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue