45 lines
998 B
PHP
45 lines
998 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
/**
|
|
* 管理员登录请求。
|
|
*
|
|
* @see LoginController
|
|
*/
|
|
final class AdminLoginRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<int, mixed>>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'account' => ['required', 'string', 'min:2', 'max:64', 'regex:/^[a-zA-Z0-9._-]+$/u'],
|
|
'password' => ['required', 'string', 'max:256'],
|
|
'captcha_key' => ['required', 'string', 'uuid'],
|
|
'captcha_code' => ['required', 'string', 'max:32'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'account' => 'account',
|
|
'password' => 'password',
|
|
'captcha_key' => 'captcha_key',
|
|
'captcha_code' => 'captcha_code',
|
|
];
|
|
}
|
|
}
|