40 lines
781 B
PHP
40 lines
781 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class LoginRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, string>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'email' => [
|
|
'required',
|
|
'string',
|
|
'email',
|
|
'max:255',
|
|
],
|
|
'password' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
];
|
|
}
|
|
|
|
protected function prepareForValidation(): void
|
|
{
|
|
$email = $this->input('email');
|
|
if (is_string($email)) {
|
|
$this->merge(['email' => trim($email)]);
|
|
}
|
|
}
|
|
}
|