You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.2 KiB

  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Request\v3;
  4. use App\Request\BaseFormRequest;
  5. class UserAddressUpdateRequest extends BaseFormRequest
  6. {
  7. /**
  8. * Get the validation rules that apply to the request.
  9. */
  10. public function rules(): array
  11. {
  12. return [
  13. 'user_id' => 'required|nonempty|integer',
  14. 'user_name' => 'required|nonempty',
  15. 'address' => 'required|nonempty',
  16. 'doorplate' => 'required|nonempty',
  17. 'gender' => 'required|nonempty|integer|between:1,2',
  18. 'lat' => 'required|nonempty',
  19. 'lng' => 'required|nonempty',
  20. 'tel' => 'required|nonempty'
  21. ];
  22. }
  23. /**
  24. * @return array
  25. */
  26. public function messages(): array
  27. {
  28. return [
  29. 'user_id.*' => ':attribute无效',
  30. 'gender.*' => ':attribute无效',
  31. ];
  32. }
  33. public function attributes(): array
  34. {
  35. return [
  36. 'user_id' => '用户id',
  37. 'user_name' => '用户名',
  38. 'address' => '地址',
  39. 'doorplate' => '门牌号',
  40. 'gender' => '性别',
  41. 'lat' => '纬度',
  42. 'lng' => '经度',
  43. 'tel' => '电话',
  44. ];
  45. }
  46. }