From 4fdc598acaaded8d843d59830fd94fb8da7c09a9 Mon Sep 17 00:00:00 2001 From: LukiBeg Date: Mon, 17 Nov 2025 17:22:02 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Inclui=20o=20m=C3=A9todo=20updateClient?= =?UTF-8?q?=20e=20utiliza=C3=A7=C3=A3o=20do=20service=20par=20realizar=20a?= =?UTF-8?q?s=20a=C3=A7=C3=B5es.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Livewire/Forms/ClientForm.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/Livewire/Forms/ClientForm.php b/app/Livewire/Forms/ClientForm.php index 0f04d91..416241e 100644 --- a/app/Livewire/Forms/ClientForm.php +++ b/app/Livewire/Forms/ClientForm.php @@ -2,6 +2,8 @@ namespace App\Livewire\Forms; +use App\Services\ClientService; +use Exception; use Livewire\Attributes\Validate; use Livewire\Form; use App\Models\Client; @@ -24,6 +26,7 @@ class ClientForm extends Form public $modules = ''; public $whatsapp_number = ''; public $whatsapp_activation_date; + public ClientService $clientService; // Método para preencher o formulário (para edição futura) public function addClient(Client $client) @@ -32,10 +35,19 @@ public function addClient(Client $client) $data['has_call_center'] = (bool) $client->has_call_center; $data['has_voice_gateway'] = (bool) $client->has_voice_gateway; $data['has_fop2'] = (bool) $client->has_fop2; + $data['client_name'] = $data['name']; $this->fill($data); } + public function updateClient(Client $client) + { + if(!$this->clientService->updateClient($client)){ + throw new Exception('Ocorreu um erro.'); + } + + + } // 4. ADICIONADO: Método de Regras /** * Define as regras de validação para o formulário.