LoginRequest.php 951 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Http\Requests\Client\Account;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class LoginRequest extends FormRequest
  5. {
  6. public function rules(): array
  7. {
  8. return [
  9. 'mobile' => 'required|string|regex:/^1[3-9]\d{9}$/',
  10. 'code' => 'required|string|size:6',
  11. 'invite_code' => 'nullable|string|max:50',
  12. ];
  13. }
  14. public function messages(): array
  15. {
  16. return [
  17. 'mobile.required' => '手机号不能为空',
  18. 'mobile.string' => '手机号必须是字符串',
  19. 'mobile.regex' => '手机号格式不正确',
  20. 'code.required' => '验证码不能为空',
  21. 'code.string' => '验证码必须是字符串',
  22. 'code.size' => '验证码必须是6位数字',
  23. 'invite_code.string' => '邀请码必须是字符串',
  24. 'invite_code.max' => '邀请码不能超过50个字符',
  25. ];
  26. }
  27. }