12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace App\Http\Requests\Client\Account;
- use Illuminate\Foundation\Http\FormRequest;
- class LoginRequest extends FormRequest
- {
- public function rules(): array
- {
- return [
- 'mobile' => 'required|string|regex:/^1[3-9]\d{9}$/',
- 'code' => 'required|string|size:6',
- 'invite_code' => 'nullable|string|max:50',
- ];
- }
- public function messages(): array
- {
- return [
- 'mobile.required' => '手机号不能为空',
- 'mobile.string' => '手机号必须是字符串',
- 'mobile.regex' => '手机号格式不正确',
- 'code.required' => '验证码不能为空',
- 'code.string' => '验证码必须是字符串',
- 'code.size' => '验证码必须是6位数字',
- 'invite_code.string' => '邀请码必须是字符串',
- 'invite_code.max' => '邀请码不能超过50个字符',
- ];
- }
- }
|