User.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2017 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 app\common\library\ValidateExtend;
  13. class User extends ValidateExtend
  14. {
  15. protected $rule = [
  16. 'username' => 'require',
  17. 'password' => 'require|length:6,30|passwordStrength:2',
  18. 'mobile' => 'require|is:mobile'
  19. ];
  20. protected $message = [
  21. 'username.require' => '用户不能为空',
  22. 'password.require' => '密码不能为空',
  23. 'password.length' => '新密码长度为 6 - 30',
  24. 'password.passwordStrength' => '新密码强度不足,至少要包含字母、数字、符号中的两种',
  25. 'mobile.require' => '手机号不能为空',
  26. 'mobile.is' => '请输入正确的手机号'
  27. ];
  28. protected $scene = [
  29. 'add' => ['username', 'password', 'mobile'],
  30. 'edit' => ['mobile'],
  31. ];
  32. }