38 lines
806 B
PHP
38 lines
806 B
PHP
<?php
|
|
|
|
namespace App\Domains\Auth\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Str;
|
|
|
|
class LoginUserRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$email = $this->input('email');
|
|
|
|
if (is_string($email)) {
|
|
$this->merge([
|
|
'email' => Str::lower(trim($email)),
|
|
]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'email' => ['required', 'string', 'email', 'max:255'],
|
|
'password' => ['required', 'string'],
|
|
'tenant_codigo' => ['required', 'string', 'exists:tenants,codigo'],
|
|
];
|
|
}
|
|
}
|