表单验证使用 unique 时忽略指定id的数据,不使用Validator类,使用 Request 怎么解决
public function rules()
{
return [
'name'=>'required|unique:app,name,(指定要忽略的ID)|string|max:32',
'description'=>'required|string|max:64',
'url'=>'required|url|string|max:128',
'code'=>'required|unique:app,code,(指定要忽略的ID)|string|max:32',
'status'=>'required|integer'
];
}
{
return [
'name'=>'required|unique:app,name,(指定要忽略的ID)|string|max:32',
'description'=>'required|string|max:64',
'url'=>'required|url|string|max:128',
'code'=>'required|unique:app,code,(指定要忽略的ID)|string|max:32',
'status'=>'required|integer'
];
}
0 个回复