UserValidate.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 小夏 < 449134904@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\validate;
  12. use think\Validate;
  13. class UserValidate extends Validate
  14. {
  15. protected $rule = [
  16. 'user_login' => 'require|unique:user,user_login',
  17. 'user_pass' => 'require',
  18. 'user_email' => 'require|email|unique:user,user_email',
  19. ];
  20. protected $message = [
  21. 'user_login.require' => '用户不能为空',
  22. 'user_login.unique' => '用户名已存在',
  23. 'user_pass.require' => '密码不能为空',
  24. 'user_email.require' => '邮箱不能为空',
  25. 'user_email.email' => '邮箱不正确',
  26. 'user_email.unique' => '邮箱已经存在',
  27. ];
  28. protected $scene = [
  29. 'add' => ['user_login', 'user_pass', 'user_email'],
  30. 'edit' => ['user_login', 'user_email'],
  31. ];
  32. }