feat: Correção de bugs e facilidades de uso.

feat: Correção de bugs e facilidades de uso.
This commit is contained in:
lukidev 2025-12-09 12:04:02 -03:00 committed by GitHub
commit 9f5d2afaec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 15 deletions

View File

@ -24,11 +24,13 @@ public function login(Request $request)
);
$request->flashOnly(['email']);
$teste = $request->old('email');
$oldInput = $request->old('email');
if (!Auth::attempt($validated)) {
return redirect()->route('login', status: 302)->with('error', 'Credenciais inválidas');
}
$request->session()->regenerate();
return redirect()->route('dashboard');
}
}

View File

@ -26,8 +26,6 @@ public function save(ClientService $clientService)
$data = $this->form->all();
$data['name'] = $data['client_name'];
dd($data);
if ($this->form->profile_image_path) {
$path = $this->form->profile_image_path->store('client_logos', 'public');
$data['profile_image_path'] = $path;

View File

@ -40,8 +40,8 @@ public function edit(ClientService $clientService)
$this->authorize('editClient', Auth::user());
$data = $this->clientForm->validate();
if ($this->clientForm->profile_image_path) {
if ($this->clientForm->profile_image_path !== null) {
$path = $this->clientForm->profile_image_path->store('client_logos', 'public');
$data['profile_image_path'] = $path;
}

View File

@ -18,14 +18,16 @@ class ClientForm extends Form
public $carrier = '';
public $access_type = '';
public $server_ip = '';
public $ddr_out = '';
public $ddr_key = '';
public $root_password = '';
public $has_call_center = false;
public $has_voice_gateway = false;
public $has_fop2 = false;
public $observation = '';
public $modules = '';
public $whatsapp_number = '';
public $whatsapp_activation_date;
// Método para preencher o formulário (para edição futura)
public function addClient(Client $client)
{
$data = $client->toArray();
@ -33,14 +35,11 @@ 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;
$this->fill($data);
}
// 4. ADICIONADO: Método de Regras
/**
* Define as regras de validação para o formulário.
*/
public function rules()
{
return [
@ -57,6 +56,9 @@ public function rules()
'access_type' => 'nullable|string|max:255',
'server_ip' => 'nullable|ip',
'root_password' => 'nullable|string',
'ddr_key' => 'nullable|string',
'ddr_out' => 'nullable|string',
'observation' => 'nullable|string',
'has_call_center' => 'boolean',
'has_voice_gateway' => 'boolean',
'has_fop2' => 'boolean',
@ -66,10 +68,6 @@ public function rules()
];
}
// 5. ADICIONADO: Método de Mensagens Customizadas
/**
* Define as mensagens de erro customizadas.
*/
public function messages()
{
return [