From c9cd343fcdf5e5464dc248c639e5a9535f91344a Mon Sep 17 00:00:00 2001 From: lukibeg Date: Mon, 24 Nov 2025 21:33:00 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Upload=20de=20imagem=20na=20edi=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20clientes/Exibi=C3=A7=C3=A3o=20de=20imagem=20do?= =?UTF-8?q?=20cliente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/Admin/Client/EditClient.php | 12 ++++++++++++ .../views/livewire/admin/show-client.blade.php | 16 +++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/Livewire/Admin/Client/EditClient.php b/app/Livewire/Admin/Client/EditClient.php index af9d250..811ee00 100644 --- a/app/Livewire/Admin/Client/EditClient.php +++ b/app/Livewire/Admin/Client/EditClient.php @@ -5,12 +5,16 @@ use App\Livewire\Forms\ClientForm; use App\Models\Client; use App\Services\ClientService; +use Illuminate\Support\Facades\Crypt; use Livewire\Attributes\On; use Livewire\Component; +use Livewire\WithFileUploads; + use Exception; class EditClient extends Component { + use WithFileUploads; public Client $client; public ClientForm $clientForm; @@ -35,6 +39,14 @@ public function edit(ClientService $clientService) { $data = $this->clientForm->validate(); + if ($this->clientForm->profile_image_path) { + $path = $this->clientForm->profile_image_path->store('client_logos', 'public'); + $data['profile_image_path'] = $path; + } + + $data['root_password'] = Crypt::encryptString($data['root_password']); + + try { if (!$clientService->updateClient($this->client, $data)) { throw new Exception('O serviço não confirmou a atualização.'); diff --git a/resources/views/livewire/admin/show-client.blade.php b/resources/views/livewire/admin/show-client.blade.php index df7ead7..c23f392 100644 --- a/resources/views/livewire/admin/show-client.blade.php +++ b/resources/views/livewire/admin/show-client.blade.php @@ -3,7 +3,7 @@
- Avatar do Cliente
@@ -16,11 +16,17 @@ class="w-32 h-32 rounded-full object-cover"> - +