From 26a25b0b074e3c9f28ec12ebc7c1678a19c35a89 Mon Sep 17 00:00:00 2001 From: LukiBeg Date: Tue, 9 Dec 2025 13:17:58 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Salva=20edi=C3=A7=C3=B5es=20sem=20upar?= =?UTF-8?q?=20imagens.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/Admin/Client/EditClient.php | 13 ++++++++++--- app/Livewire/Forms/ClientForm.php | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/Livewire/Admin/Client/EditClient.php b/app/Livewire/Admin/Client/EditClient.php index 998967f..3b906d7 100644 --- a/app/Livewire/Admin/Client/EditClient.php +++ b/app/Livewire/Admin/Client/EditClient.php @@ -40,13 +40,20 @@ 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']); } - $data['root_password'] = Crypt::encryptString($data['root_password']); + 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.'); diff --git a/app/Livewire/Forms/ClientForm.php b/app/Livewire/Forms/ClientForm.php index 99e8950..0970440 100644 --- a/app/Livewire/Forms/ClientForm.php +++ b/app/Livewire/Forms/ClientForm.php @@ -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); }