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.

66 lines
2.2 KiB

5 years ago
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Request\v3;
  4. use App\Request\BaseFormRequest;
  5. class EvaluateRequest extends BaseFormRequest
  6. {
  7. /**
  8. * Determine if the user is authorized to make this request.
  9. */
  10. public function authorize(): bool
  11. {
  12. return true;
  13. }
  14. /**
  15. * Get the validation rules that apply to the request.
  16. */
  17. public function rules(): array
  18. {
  19. return [
  20. 'c_attitude' => 'required|nonempty',
  21. 'c_service' => 'required|nonempty',
  22. 'c_quality' => 'required|nonempty',
  23. 'content' => 'required|nonempty|strlen:15,150',
  24. 'user_id' => 'required|nonempty|integer|exists:ims_cjdc_user,id',
  25. 'service_personnel_id' => 'required|nonempty|integer|exists_enable:lanzu_service_personnel,id,status=1|not_equal:user_id,lanzu_service_personnel,id,user_id',
  26. 'market_id' => 'required|nonempty|integer|exists:ims_cjdc_market,id',
  27. ];
  28. }
  29. public function messages(): array
  30. {
  31. return [
  32. 'user_id.exists' => ':attribute不存在',
  33. 'service_personnel_id.exists' => ':attribute不存在',
  34. 'market_id.exists' => ':attribute不存在',
  35. 'user_id.*' => ':attribute信息不正确',
  36. 'service_personnel_id.exists_enable' => ':attribute不存在或被禁用',
  37. 'service_personnel_id.not_equal' => ':attribute不能是自己',
  38. 'service_personnel_id.*' => ':attribute信息不正确',
  39. 'market_id.*' => ':attribute信息不正确',
  40. 'c_attitude.*' => ':attribute信息不正确',
  41. 'c_service.*' => ':attribute信息不正确',
  42. 'c_quality.*' => ':attribute信息不正确',
  43. 'content.strlen' => ':attribute字数限制在:min~:max字',
  44. 'content.*' => ':attribute信息不正确',
  45. ];
  46. }
  47. public function attributes(): array
  48. {
  49. return [
  50. 'user_id' => '用户',
  51. 'service_personnel_id' => '服务专员',
  52. 'market_id' => '服务专员市场',
  53. 'c_attitude' => '服务态度评分',
  54. 'c_service' => '服务值评分',
  55. 'c_quality' => '服务质量评分',
  56. 'content' => '服务评价内容',
  57. ];
  58. }
  59. }