refactor: Obtém cliente criado e exibe nome na notificação.
This commit is contained in:
parent
47eeaa59be
commit
7fce28174e
|
|
@ -24,7 +24,6 @@ public function save(ClientService $clientService)
|
|||
$data = $this->form->all();
|
||||
$data['name'] = $data['client_name'];
|
||||
|
||||
|
||||
if ($this->form->profile_image_path) {
|
||||
$path = $this->form->profile_image_path->store('client_logos', 'public');
|
||||
$data['profile_image_path'] = $path;
|
||||
|
|
@ -32,10 +31,10 @@ public function save(ClientService $clientService)
|
|||
|
||||
$data['root_password'] = Crypt::encryptString($data['root_password']);
|
||||
|
||||
$clientService->addClient($data);
|
||||
$client = $clientService->addClient($data);
|
||||
|
||||
$this->dispatch('client-added');
|
||||
$this->dispatch('notify', message: 'Cliente adicionado com sucesso!');
|
||||
$this->dispatch('notify', message: $client->name . ' Cliente adicionado com sucesso!');
|
||||
} catch (\Exception $e) {
|
||||
$this->dispatch('notify', message: 'Ocorreu um erro inesperado ao salvar.', type: 'error');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue