Compare commits

..

2 Commits

Author SHA1 Message Date
lukidev 9f5d2afaec
feat: Correção de bugs e facilidades de uso.
feat: Correção de bugs e facilidades de uso.
2025-12-09 12:04:02 -03:00
LukiBeg 44a9ff217e feat: Correção de bugs e facilidades de uso. 2025-12-09 11:59:07 -03:00
4 changed files with 13 additions and 15 deletions

View File

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

View File

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

View File

@ -40,8 +40,8 @@ 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) { if ($this->clientForm->profile_image_path !== null) {
$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;
} }

View File

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