1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\common\validate;
- use think\Validate;
- class PreOrder extends Validate
- {
- // 验证规则
- protected $rule = [
- 'id' => 'require|number',
- 'company_id' => 'number',
- 'name' => 'require|max:32',
- 'mobile' => 'require|max:32',
- 'address' => 'max:256',
- 'car_id' => 'require|number',
- 'servicetype_id' => 'require|number',
- 'pre_time' => 'require',
- 'remark' => 'max:256',
- 'cancel_reason' => 'max:128',
- ];
- // 验证提示
- protected $message = [
- 'id.require' => '请输入预约单ID',
- 'id.number' => '您输入的预约单ID,必须是数字类型',
- 'company_id.number' => '您输入的门店,必须是数字类型',
- 'name.require' => '请输入联系人',
- 'name.max' => '您输入的联系人,必须小于32字符',
- 'mobile.require' => '请输入联系电话',
- 'mobile.max' => '您输入的联系电话,必须小于32字符',
- 'address.require' => '请输入联系地址',
- 'address.max' => '您输入的联系地址,必须小于256字符',
- 'car_id.require' => '请输入车辆',
- 'car_id.number' => '您输入的车辆,必须是数字类型',
- 'servicetype_id.require' => '请输入服务类型',
- 'servicetype_id.number' => '您输入的服务类型,必须是数字类型',
- 'pre_time.require' => '请输入预约时间',
- 'remark.max' => '您输入的备注,必须小于256字符',
- 'cancel_reason.max' => '您输入的备注,必须小于128字符',
- ];
- // 应用场景
- protected $scene = [
- 'add' => ['company_id','name','mobile','address','car_id','servicetype_id','pre_time','remark','cancel_reason'],
- 'edit' => ['id','company_id','name','mobile','address','car_id','servicetype_id','pre_time','remark','cancel_reason'],
- ];
- }
|