Compare commits

..

2 Commits

Author SHA1 Message Date
lukidev ee74cd3ccb
feat: Salva edições sem upar imagens.
feat: Salva edições sem upar imagens.
2025-12-09 13:19:45 -03:00
LukiBeg 26a25b0b07 feat: Salva edições sem upar imagens. 2025-12-09 13:17:58 -03:00
2 changed files with 12 additions and 5 deletions

View File

@ -41,12 +41,19 @@ public function edit(ClientService $clientService)
$this->authorize('editClient', Auth::user()); $this->authorize('editClient', Auth::user());
$data = $this->clientForm->validate(); $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'); $path = $this->clientForm->profile_image_path->store('client_logos', 'public');
$data['profile_image_path'] = $path; $data['profile_image_path'] = $path;
} else {
unset($data['profile_image_path']);
} }
if (!empty($data['root_password'])) {
$data['root_password'] = Crypt::encryptString($data['root_password']); $data['root_password'] = Crypt::encryptString($data['root_password']);
} else {
unset($data['root_password']);
}
if (!$clientService->updateClient($this->client, $data)) { if (!$clientService->updateClient($this->client, $data)) {
throw new Exception('O serviço não confirmou a atualização.'); throw new Exception('O serviço não confirmou a atualização.');

View File

@ -12,7 +12,7 @@ class ClientForm extends Form
public $client_name = ''; public $client_name = '';
public $legal_name = ''; public $legal_name = '';
public $cnpj = ''; public $cnpj = '';
public $profile_image_path; public $profile_image_path = null;
public $pbx_hosting = ''; public $pbx_hosting = '';
public $activation_date; public $activation_date;
public $carrier = ''; public $carrier = '';
@ -35,7 +35,7 @@ public function addClient(Client $client)
$data['has_voice_gateway'] = (bool) $client->has_voice_gateway; $data['has_voice_gateway'] = (bool) $client->has_voice_gateway;
$data['has_fop2'] = (bool) $client->has_fop2; $data['has_fop2'] = (bool) $client->has_fop2;
$data['client_name'] = $data['name']; $data['client_name'] = $data['name'];
$data['whatsapp_activation_date'] = $client->whatsapp_activation_date; unset($data['profile_image_path']);
$this->fill($data); $this->fill($data);
} }