Article.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 验证器
  13. */
  14. class Article extends Validate
  15. {
  16. protected $rule = [
  17. 'article_sort' => 'number',
  18. 'article_title' => 'require',
  19. 'ac_name' => 'require',
  20. 'ac_sort' => 'number'
  21. ];
  22. protected $message = [
  23. 'article_sort.number' => '排序只能为数字',
  24. 'article_title.require' => '标题名称不能为空',
  25. 'ac_name.require' => '分类名称不能为空',
  26. 'ac_sort.number' => '分类排序仅能为数字'
  27. ];
  28. protected $scene = [
  29. 'add' => ['article_sort', 'article_title'],
  30. 'edit' => ['article_sort', 'article_title'],
  31. 'article_class_add' => ['ac_name', 'ac_sort'],
  32. 'article_class_edit' => ['ac_name', 'ac_sort'],
  33. ];
  34. }