MenuValidate.php 693 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-03-26
  7. *
  8. *
  9. */
  10. namespace app\validate\admin;
  11. use think\Validate;
  12. class MenuValidate extends Validate
  13. {
  14. protected $failException = true;
  15. protected $rule = [
  16. 'pid|选择父级分类' => 'require|integer|max:5',
  17. 'icon|图标' => 'max:16',
  18. 'menu_name|按钮名' => 'require|max:32',
  19. 'route|菜单地址' => 'require|max:64',
  20. 'sort|排序' => 'integer|max:3',
  21. 'is_show|是否显示' => 'integer|in:0,1',
  22. ];
  23. public function isAuth()
  24. {
  25. unset($this->rule['icon|图标']);
  26. unset($this->rule['is_show|是否显示']);
  27. return $this;
  28. }
  29. }