Topicword.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace App\Http\Requests\Community\CommBackend;
  3. use App\Http\Requests\BaseRequest;
  4. /**
  5. * 帖子违禁词验证器
  6. * @author 唐远望
  7. * @version 1.0
  8. * @date 2025-04-16
  9. *
  10. */
  11. class Topicword extends BaseRequest
  12. {
  13. /**
  14. * 获取应用于请求的规则
  15. *
  16. * @return array
  17. */
  18. public function rules()
  19. {
  20. // 返回结果
  21. return [
  22. 'name' => 'required',
  23. 'id' => 'required|integer|gt:0',
  24. 'status' => 'required|integer|in:0,1',
  25. 'page' => 'integer|min:1',
  26. 'limit' => 'integer|min:1',
  27. ];
  28. }
  29. // 场景列表
  30. protected $scenes = [
  31. 'detail' => ['id'],
  32. 'list' => ['page', 'limit'],
  33. 'add' => ['name','status'],
  34. 'edit' => ['id', 'name'],
  35. 'set_status' => ['id', 'status'],
  36. 'delete' => ['id'],
  37. 'update_config' => ['content'],
  38. ];
  39. /**
  40. * 获取已定义验证规则的错误消息
  41. *
  42. * @return array
  43. */
  44. public function messages()
  45. {
  46. return [
  47. 'name.required' => '名称必填',
  48. 'id.required' => 'ID未知',
  49. 'id.integer' => 'ID格式错误',
  50. 'id.gt' => 'ID格式错误',
  51. 'status.required' => '状态未知',
  52. 'status.integer' => '状态格式错误',
  53. 'status.in' => '状态格式错误',
  54. 'page.integer' => '页码格式错误',
  55. 'page.min' => '页码格式错误',
  56. 'limit.integer' => '每页数量格式错误',
  57. 'limit.min' => '每页数量格式错误',
  58. ];
  59. }
  60. }