RoleValidate.php 689 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace app\admin\validate\role;
  3. use think\Validate;
  4. class RoleValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'role_name' => 'require|max:20',
  8. 'role_id' => 'require',
  9. 'role_rules' => 'require',
  10. ];
  11. protected $message = [
  12. 'role_name.require' => '角色名称不能为空',
  13. 'role_rules.require'=> '身份管理权限不能为空',
  14. 'role_id.require' => '角色id不能为空',
  15. 'role_name.max' => '角色名称不能超过20字'
  16. ];
  17. //场景
  18. protected $scene = [
  19. 'create' => ['role_name'],
  20. 'update' => ['role_id','role_name'],
  21. 'info' => ['role_id']
  22. ];
  23. }