IndexValidate.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\admin\validate\index;
  3. use think\Validate;
  4. class IndexValidate extends Validate
  5. {
  6. //定义规则
  7. protected $rule = [
  8. 'old_pwd' => 'require',
  9. 'new_pwd' => 'require',
  10. 'confirm_pwd' => 'require',
  11. 'admin_id' => 'require',
  12. 'admin_real_name' => 'require',
  13. 'admin_pwd' => 'require',
  14. 'agin_admin_pwd' => 'require',
  15. 'admin_status' => 'require',
  16. ];
  17. //定义描述
  18. protected $message = [
  19. 'old_pwd.require' => '旧密码不能为空',
  20. 'new_pwd.require' => '新密码不能为空',
  21. 'confirm_pwd.require' => '确认密码不能为空',
  22. 'admin_id.require' => '管理员id不能为空',
  23. 'admin_real_name.require' => '管理员姓名不能为空',
  24. 'admin_pwd.require' => '管理员密码不能为空',
  25. 'agin_admin_pwd.require' => '确认密码不能为空',
  26. 'admin_status.require' => '管理员状态不能为空',
  27. 'admin_roles.require' => '管理员权限不能为空',
  28. 'admin_account.require'=> '管理员账号不能为空',
  29. ];
  30. //定义场景
  31. protected $scene = [
  32. 'up_pwd' => ['old_pwd','new_pwd', 'confirm_pwd'],
  33. 'info' => ['admin_id'],
  34. 'update' => ['admin_id'],
  35. 'create' => ['admin_real_name','admin_pwd','agin_admin_pwd','admin_status','admin_roles','admin_account'],
  36. ];
  37. }