AdminSetRequest.php 1.0 KB

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