form->validate(); try { $data = $this->form->all(); $data['name'] = $data['client_name']; if ($this->form->profile_image_path) { $path = $this->form->profile_image_path->store('client_logos', 'public'); $data['profile_image_path'] = $path; } $data['root_password'] = Crypt::encryptString($data['root_password']); $clientService->addClient($data); $this->dispatch('client-added'); $this->dispatch('notify', message: 'Cliente adicionado com sucesso!'); } catch (\Exception $e) { $this->dispatch('notify', message: 'Ocorreu um erro inesperado ao salvar.', type: 'error'); } } public function render() { return view('livewire.admin.add-client'); } }