BlackAddRequest.php 1.1 KB

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