UserCar.php 849 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. class UserCar extends Validate
  5. {
  6. // 验证规则
  7. protected $rule = [
  8. 'id' => 'require|number',
  9. 'car_number' => 'require|max:64',
  10. 'car_model' => 'require|max:128',
  11. ];
  12. // 验证提示
  13. protected $message = [
  14. 'id.require' => '请输入车辆ID',
  15. 'id.number' => '您输入的车辆ID,必须是数字类型',
  16. 'car_number.require' => '请输入车牌号',
  17. 'car_number.max' => '您输入的车牌号,必须小于64字符',
  18. 'car_model.require' => '请输入车辆型号',
  19. 'car_model.max' => '您输入的车辆型号,必须小于128字符',
  20. ];
  21. // 应用场景
  22. protected $scene = [
  23. 'add' => ['car_number', 'car_model'],
  24. 'edit' => ['id','car_number', 'car_model'],
  25. ];
  26. }