wp车辆信息
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class UsedCarDetailValidate extends Validate
|
||||
{
|
||||
// 规则
|
||||
protected $rule = [
|
||||
'id' => 'requireWith:id',
|
||||
'product_name' => 'require|max:255',
|
||||
'price' => 'require|float|>=:0',
|
||||
'user_id' => 'require|integer',
|
||||
'role' => 'integer|in:1,2,3,4',
|
||||
];
|
||||
|
||||
// 提示
|
||||
protected $message = [
|
||||
'product_name.require' => '产品名称不能为空',
|
||||
'product_name.max' => '产品名称最多255个字符',
|
||||
'price.require' => '车辆价格不能为空',
|
||||
'price.float' => '车辆价格格式不正确',
|
||||
'price.>=' => '车辆价格不能为负数',
|
||||
'role.in' => '角色值不正确',
|
||||
];
|
||||
|
||||
// 场景
|
||||
protected $scene = [
|
||||
'store' => ['product_name', 'price', 'user_id', 'role'],
|
||||
'update' => ['id', 'product_name', 'price'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user