AddressValidate.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\http\validates\user;
  3. use think\Validate;
  4. /**
  5. * 用户地址验证类
  6. * Class AddressValidate
  7. * @package app\http\validates\user
  8. */
  9. class AddressValidate extends Validate
  10. {
  11. //移动
  12. protected $regex = [ 'phone' => '/^1[3456789]\d{9}|([0-9]{3,4}-)?[0-9]{7,8}$/'];
  13. protected $rule = [
  14. 'real_name' => 'require|max:25',
  15. 'phone' => 'require|regex:phone',
  16. 'province' => 'require',
  17. 'city' => 'require',
  18. 'district' => 'require',
  19. 'detail' => 'require',
  20. ];
  21. protected $message = [
  22. 'real_name.require' => '名称必须填写',
  23. 'real_name.max' => '名称最多不能超过25个字符',
  24. 'phone.require' => '手机号必须填写',
  25. 'phone.regex' => '手机号格式错误',
  26. 'province.require' => '省必须填写',
  27. 'city.require' => '市名称必须填写',
  28. 'district.require' => '区/县名称必须填写',
  29. 'detail.require' => '详细地址必须填写',
  30. ];
  31. }