Admin.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 验证器
  10. */
  11. class Admin extends Validate
  12. {
  13. protected $rule = [
  14. 'admin_name' => 'require|length:3,12',
  15. 'admin_password' => 'require|min:6',
  16. 'admin_gid' => 'require',
  17. 'captcha' => 'require|min:3',
  18. ];
  19. protected $message = [
  20. 'admin_name.require' => '登录名必填',
  21. 'admin_name.length' => '登录名长度在3到12位',
  22. 'admin_password.require' => '密码为必填',
  23. 'admin_password.min' => '密码长度至少为6位',
  24. 'admin_gid.require' => '权限组为必填',
  25. 'captcha.require' => '验证码为必填',
  26. 'captcha.min' => '验证码长度至少为3位',
  27. ];
  28. protected $scene = [
  29. 'admin_add' => ['admin_name', 'admin_password', 'admin_gid'],
  30. 'index' => ['admin_name', 'admin_password', 'captcha'], //login index
  31. ];
  32. }