@@ -355,7 +355,7 @@ public function whereValidate(&$validate_rules, $value, $key)
355
355
protected function existFullTextSearch (){
356
356
if (!isset ($ this ->hasFullTextSearch ) || is_null ($ this ->hasFullTextSearch )){
357
357
$ this ->hasFullTextSearch = collect (Arr::get ($ this ->getOptions (),'where ' ,[]))
358
- ->where ('exp ' ,'= ' ,'search ' )
358
+ ->where ('exp ' ,'= ' ,'search ' )
359
359
->first ()?:false ;
360
360
}
361
361
return $ this ->hasFullTextSearch ;
@@ -512,7 +512,9 @@ public function delete()
512
512
public function create (\Illuminate \Http \Request $ request )
513
513
{
514
514
$ validate = $ this ->getValidateRule (0 );
515
- $ validator = Validator::make ($ request ->all (), $ validate );
515
+ $ messages = $ this ->validateMessages ??[];
516
+ $ customAttributes = $ this ->validateCustomAttributes ??[];
517
+ $ validator = Validator::make ($ request ->all (), $ validate ,$ messages ,$ customAttributes );
516
518
if ($ validator ->fails ()) {
517
519
return Response::returns ([
518
520
'errors ' => $ validator ->errors ()->toArray (),
@@ -556,7 +558,9 @@ public function update($id = 0)
556
558
$ request = Request::instance ();
557
559
$ id = $ id ?: $ request ->get ('id ' , 0 );
558
560
$ validate = $ this ->getValidateRule ($ id );
559
- $ validator = Validator::make ($ request ->all (), $ validate );
561
+ $ messages = $ this ->validateMessages ??[];
562
+ $ customAttributes = $ this ->validateCustomAttributes ??[];
563
+ $ validator = Validator::make ($ request ->all (), $ validate ,$ messages ,$ customAttributes );
560
564
if ($ validator ->fails ()) {
561
565
return Response::returns ([
562
566
'errors ' => $ validator ->errors ()->toArray (),
@@ -660,7 +664,7 @@ protected function getWithOptionModel($fields_key = 'showIndexFields',$unset_ord
660
664
}else {
661
665
$ obj = $ obj ->where ($ item ['key ' ],$ item ['exp ' ],$ item ['val ' ]);
662
666
}
663
- });
667
+ });
664
668
collect (Arr::get ($ options ,'order ' ,[]))
665
669
->each (function ($ item ,$ key )use (&$ obj ){
666
670
$ obj = $ obj ->orderBy ($ key ,$ item );
@@ -1232,7 +1236,9 @@ public function import()
1232
1236
})->filter (function ($ item ) use (&$ errors , $ key_name , $ relation_keys , $ maps1 , $ multipleFields ) { //数据验证
1233
1237
$ data = getRelationData ($ item );
1234
1238
$ data = $ this ->handleImportValidateBefore ($ data );
1235
- $ validator = Validator::make ($ data , $ this ->getImportValidateRule (Arr::get ($ data , $ key_name , 0 ), $ data ), [], $ this ->exportFieldsName );
1239
+ $ messages = $ this ->validateMessages ??[];
1240
+ $ customAttributes = $ this ->validateCustomAttributes ??[];
1241
+ $ validator = Validator::make ($ data , $ this ->getImportValidateRule (Arr::get ($ data , $ key_name , 0 ), $ data ), $ messages , array_merge ($ customAttributes ,$ this ->exportFieldsName ));
1236
1242
$ flog = !$ validator ->fails (); //验证状态
1237
1243
if ($ validator ->fails ()) {
1238
1244
$ item ['error ' ] = collect ($ validator ->errors ()->toArray ())->map (function ($ v , $ k ) {
0 commit comments