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