123456789101112131415161718192021222324252627282930 |
- <?php
- namespace app\common\validate;
- use think\Validate;
- class UserCar extends Validate
- {
- // 验证规则
- protected $rule = [
- 'id' => 'require|number',
- 'car_number' => 'require|max:64',
- 'car_model' => 'require|max:128',
- ];
- // 验证提示
- protected $message = [
- 'id.require' => '请输入车辆ID',
- 'id.number' => '您输入的车辆ID,必须是数字类型',
- 'car_number.require' => '请输入车牌号',
- 'car_number.max' => '您输入的车牌号,必须小于64字符',
- 'car_model.require' => '请输入车辆型号',
- 'car_model.max' => '您输入的车辆型号,必须小于128字符',
- ];
- // 应用场景
- protected $scene = [
- 'add' => ['car_number', 'car_model'],
- 'edit' => ['id','car_number', 'car_model'],
- ];
- }
|