如何通过#Laravel 5.4验证连续存在的两列 现在按以下方式进行操作:
$validator = \Validator::make($request->all(), [
'classlevel_id'=>'required',
'book_name'=>'required|string',
'class_no'=>'required|integer',
]);
if($validator->fails())
{
return response()->json(['errors'=>$validator->errors()->all()]);
}else{
$valid = DB::table('books')->where('class_no',$request->class_no)->where('book_name',$request->book_name)->exists();
if($valid){
return response()->json(['warning'=>"Book : ".$request->book_name." and class : ".$request->class_no." already Exists"]);
}
}
$validator = \Validator::make($request->all(), [
'classlevel_id'=>'required',
'book_name'=>'required|string|unique:books|required_with:class_no',
'class_no'=>'required|string|unique:books|required_with:book_name',
]);
是否有任何Laravel Validate命令用于验证连续存在的两列?