Article.php 937 B

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