MenuValidate.php 621 B

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