feat: Salva edições sem upar imagens.
This commit is contained in:
parent
44a9ff217e
commit
26a25b0b07
|
|
@ -40,13 +40,20 @@ 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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$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)) {
|
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.');
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue