44 lines
930 B
PHP
44 lines
930 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Request\Admin;
|
|
|
|
use Hyperf\Validation\Request\FormRequest;
|
|
|
|
class LoginRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'account' => 'required|digits:11',
|
|
'password' => 'required|string|min:6',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'account.required' => '请输入账号',
|
|
'account.digits' => '账号格式错误',
|
|
'password.required' => '请输入密码',
|
|
'password.min' => '密码不能小于6位'
|
|
];
|
|
}
|
|
|
|
protected array $scenes = [
|
|
'login' => ['account', 'password'],
|
|
];
|
|
}
|