Companys.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. class Companys extends Validate
  5. {
  6. // 验证规则
  7. protected $rule = [
  8. 'id' => 'require|number',
  9. 'contacts' => 'require|max:32',
  10. 'mobile' => 'require|max:16',
  11. 'province_id' => 'require|number',
  12. 'city_id' => 'require|number',
  13. 'area_id' => 'require|number',
  14. 'address' => 'require|max:255',
  15. 'aptitude_images' => 'require|max:256',
  16. ];
  17. // 验证提示
  18. protected $message = [
  19. 'id.require' => '请输入门店ID',
  20. 'id.number' => '您输入的门店ID,必须是数字类型',
  21. 'contacts.require' => '请输入联系人',
  22. 'contacts.max' => '您输入的联系人,必须小于32字符',
  23. 'mobile.require' => '请输入联系电话',
  24. 'mobile.max' => '您输入的联系电话,必须小于16字符',
  25. 'province_id.require' => '请输入省',
  26. 'province_id.number' => '您输入的省,必须是数字类型',
  27. 'city_id.require' => '请输入市',
  28. 'city_id.number' => '您输入的市,必须是数字类型',
  29. 'area_id.require' => '请输入区县',
  30. 'area_id.number' => '您输入的区县,必须是数字类型',
  31. 'address.require' => '请输入联系地址',
  32. 'address.max' => '您输入的联系地址,必须小于255字符',
  33. 'aptitude_images.require' => '请输入资质',
  34. 'aptitude_images.max' => '您输入的资质,必须小于256字符',
  35. ];
  36. // 应用场景
  37. protected $scene = [
  38. 'add' => ['contacts','mobile','province_id','city_id','area_id','address','aptitude_images'],
  39. 'edit' => ['contacts','mobile','province_id','city_id','area_id','address','aptitude_images'],
  40. ];
  41. }