32 lines
822 B
PHP
32 lines
822 B
PHP
|
<?php declare(strict_types=1);
|
||
|
|
||
|
namespace App\Http\Requests;
|
||
|
|
||
|
use App\Contracts\FormRequestDto;
|
||
|
use App\Dto\Request\Authorization;
|
||
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
||
|
final class AuthorizationRequest extends FormRequest implements FormRequestDto
|
||
|
{
|
||
|
/**
|
||
|
* Get the validation rules that apply to the request.
|
||
|
*/
|
||
|
public function rules(): array
|
||
|
{
|
||
|
return [
|
||
|
'email' => ['required', 'email', 'max:255'],
|
||
|
'password' => ['required', 'min:3'],
|
||
|
'remember' => ['nullable', 'boolean'],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function getDto(): Authorization
|
||
|
{
|
||
|
return new Authorization(
|
||
|
email: $this->input('email'),
|
||
|
password: $this->input('password'),
|
||
|
remember: (bool) $this->input('remember', false)
|
||
|
);
|
||
|
}
|
||
|
}
|