feat: Salva edições sem upar imagens.
feat: Salva edições sem upar imagens.
This commit is contained in:
commit
ee74cd3ccb
|
|
@ -41,12 +41,19 @@ public function edit(ClientService $clientService)
|
|||
$this->authorize('editClient', Auth::user());
|
||||
$data = $this->clientForm->validate();
|
||||
|
||||
if ($this->clientForm->profile_image_path !== null) {
|
||||
|
||||
if ($this->clientForm->profile_image_path) {
|
||||
$path = $this->clientForm->profile_image_path->store('client_logos', 'public');
|
||||
$data['profile_image_path'] = $path;
|
||||
} else {
|
||||
unset($data['profile_image_path']);
|
||||
}
|
||||
|
||||
if (!empty($data['root_password'])) {
|
||||
$data['root_password'] = Crypt::encryptString($data['root_password']);
|
||||
} else {
|
||||
unset($data['root_password']);
|
||||
}
|
||||
|
||||
if (!$clientService->updateClient($this->client, $data)) {
|
||||
throw new Exception('O serviço não confirmou a atualização.');
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ClientForm extends Form
|
|||
public $client_name = '';
|
||||
public $legal_name = '';
|
||||
public $cnpj = '';
|
||||
public $profile_image_path;
|
||||
public $profile_image_path = null;
|
||||
public $pbx_hosting = '';
|
||||
public $activation_date;
|
||||
public $carrier = '';
|
||||
|
|
@ -35,7 +35,7 @@ public function addClient(Client $client)
|
|||
$data['has_voice_gateway'] = (bool) $client->has_voice_gateway;
|
||||
$data['has_fop2'] = (bool) $client->has_fop2;
|
||||
$data['client_name'] = $data['name'];
|
||||
$data['whatsapp_activation_date'] = $client->whatsapp_activation_date;
|
||||
unset($data['profile_image_path']);
|
||||
|
||||
$this->fill($data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue