AudienceRequest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Request\Api\v1\Live;
  4. use Hyperf\Validation\Request\FormRequest;
  5. class AudienceRequest extends FormRequest
  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. 'keyword' => 'nullable|string',
  21. 'room_no' => 'required|string',
  22. 'page' => 'nullable|integer:strict',
  23. 'list_rows' => 'nullable|integer:strict',
  24. ];
  25. }
  26. /**
  27. * 获取已定义验证规则的错误消息
  28. */
  29. public function messages(): array
  30. {
  31. return [
  32. 'room_no.required' => '请填写直播间号',
  33. ];
  34. }
  35. /**
  36. * 验证的各字段的含义
  37. * @return array|string[]
  38. */
  39. public function attributes(): array
  40. {
  41. return [
  42. 'keyword' => '关键词',
  43. 'room_no' => '直播间号',
  44. 'page' => '页码',
  45. 'list_rows' => '条数',
  46. ];
  47. }
  48. }