@@ -401,10 +401,10 @@ public function resolveShowAttributes(RestifyRequest $request)
401401 {
402402 $ fields = $ this ->collectFields ($ request )
403403 ->forShow ($ request , $ this )
404- ->filter (fn (Field $ field ) => $ field ->authorize ($ request ))
405- ->each (fn (Field $ field ) => $ field ->resolveForShow ($ this ))
406- ->map (fn (Field $ field ) => $ field ->serializeToValue ($ request ))
407- ->mapWithKeys (fn ($ value ) => $ value )
404+ ->filter (fn (Field $ field ) => $ field ->authorize ($ request ))
405+ ->each (fn (Field $ field ) => $ field ->resolveForShow ($ this ))
406+ ->map (fn (Field $ field ) => $ field ->serializeToValue ($ request ))
407+ ->mapWithKeys (fn ($ value ) => $ value )
408408 ->all ();
409409
410410 if ($ this instanceof Mergeable) {
@@ -469,17 +469,17 @@ public function resolveIndexAttributes($request)
469469 ->collectFields ($ request )
470470 ->when (
471471 $ this ->hasCustomColumns (),
472- fn (FieldCollection $ fields ) => $ fields ->inList ($ this ->getColumns ())
472+ fn (FieldCollection $ fields ) => $ fields ->inList ($ this ->getColumns ())
473473 )
474474 ->forIndex ($ request , $ this )
475- ->filter (fn (Field $ field ) => $ field ->authorize ($ request ))
475+ ->filter (fn (Field $ field ) => $ field ->authorize ($ request ))
476476 ->when (
477477 $ this ->eagerState ,
478- fn ($ items ) => $ items ->filter (fn (Field $ field ) => ! $ field instanceof EagerField)
478+ fn ($ items ) => $ items ->filter (fn (Field $ field ) => ! $ field instanceof EagerField)
479479 )
480- ->each (fn (Field $ field ) => $ field ->resolveForIndex ($ this ))
481- ->map (fn (Field $ field ) => $ field ->serializeToValue ($ request ))
482- ->mapWithKeys (fn ($ value ) => $ value )
480+ ->each (fn (Field $ field ) => $ field ->resolveForIndex ($ this ))
481+ ->map (fn (Field $ field ) => $ field ->serializeToValue ($ request ))
482+ ->mapWithKeys (fn ($ value ) => $ value )
483483 ->all ();
484484 }
485485
@@ -513,10 +513,10 @@ public function resolveShowPivots(RestifyRequest $request): array
513513 }
514514
515515 return $ pivots
516- ->filter (fn (Field $ field ) => $ field ->authorize ($ request ))
517- ->each (fn (Field $ field ) => $ field ->resolve ($ this ))
518- ->map (fn (Field $ field ) => $ field ->serializeToValue ($ request ))
519- ->mapWithKeys (fn ($ value ) => $ value )
516+ ->filter (fn (Field $ field ) => $ field ->authorize ($ request ))
517+ ->each (fn (Field $ field ) => $ field ->resolve ($ this ))
518+ ->map (fn (Field $ field ) => $ field ->serializeToValue ($ request ))
519+ ->mapWithKeys (fn ($ value ) => $ value )
520520 ->all ();
521521 }
522522
@@ -540,7 +540,7 @@ public function resolveRelationships($request): array
540540 ->forRequest ($ request , $ this )
541541 ->mapIntoRelated ($ request , $ this )
542542 ->unserialized ($ request , $ this )
543- ->map (fn (Related $ related ) => $ related ->resolve ($ request , $ this )->getValue ())
543+ ->map (fn (Related $ related ) => $ related ->resolve ($ request , $ this )->getValue ())
544544 ->map (function (mixed $ items ) {
545545 if ($ items instanceof Collection) {
546546 return $ items ->filter ()->values ();
@@ -608,13 +608,13 @@ public function indexAsArray(RestifyRequest $request): array
608608 return $ repository ->authorizedToShow ($ request );
609609 })->values ();
610610
611- $ data = $ items ->map (fn (self $ repository ) => $ repository ->serializeForIndex ($ request ));
611+ $ data = $ items ->map (fn (self $ repository ) => $ repository ->serializeForIndex ($ request ));
612612
613613 return $ this ->filter ([
614614 'meta ' => $ this ->when (
615615 $ meta = $ this ->resolveIndexMainMeta (
616616 $ request ,
617- $ models = $ items ->map (fn (self $ repository ) => $ repository ->resource ),
617+ $ models = $ items ->map (fn (self $ repository ) => $ repository ->resource ),
618618 [
619619 'current_page ' => $ paginator ->currentPage (),
620620 'from ' => $ paginator ->firstItem (),
@@ -700,14 +700,14 @@ public function store(RestifyRequest $request)
700700 }
701701 }
702702
703- $ fields ->each (fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource ));
703+ $ fields ->each (fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource ));
704704
705705 $ this
706706 ->collectFields ($ request )
707707 ->forStore ($ request , $ this )
708708 ->withActions ($ request , $ this )
709709 ->authorizedStore ($ request )
710- ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource ));
710+ ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource ));
711711 });
712712
713713 if (method_exists (static ::class, 'stored ' )) {
@@ -736,14 +736,14 @@ public function storeBulk(RepositoryStoreBulkRequest $request)
736736
737737 $ this ->resource ->save ();
738738
739- $ fields ->each (fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource ));
739+ $ fields ->each (fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource ));
740740
741741 $ this
742742 ->collectFields ($ request )
743743 ->forStoreBulk ($ request , $ this )
744744 ->withActions ($ request , $ this , $ row )
745745 ->authorizedUpdateBulk ($ request )
746- ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource , $ row ));
746+ ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource , $ row ));
747747
748748 return $ this ->resource ;
749749 });
@@ -770,15 +770,15 @@ public function update(RestifyRequest $request, $repositoryId)
770770
771771 return $ fields ;
772772 })->each (
773- fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource )
773+ fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource )
774774 );
775775
776776 $ this
777777 ->collectFields ($ request )
778778 ->forUpdate ($ request , $ this )
779779 ->withActions ($ request , $ this )
780780 ->authorizedUpdate ($ request )
781- ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource ));
781+ ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource ));
782782
783783 return data ($ this ->serializeForShow ($ request ));
784784 }
@@ -790,7 +790,7 @@ public function patch(RestifyRequest $request, $repositoryId)
790790 DB ::transaction (function () use ($ request , $ keys ) {
791791 $ fields = $ this ->collectFields ($ request )
792792 ->filter (
793- fn (Field $ field ) => in_array ($ field ->attribute , $ keys ),
793+ fn (Field $ field ) => in_array ($ field ->attribute , $ keys ),
794794 )
795795 ->forUpdate ($ request , $ this )
796796 ->withoutActions ($ request , $ this )
@@ -809,18 +809,18 @@ public function patch(RestifyRequest $request, $repositoryId)
809809
810810 return $ fields ;
811811 })->each (
812- fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource )
812+ fn (Field $ field ) => $ field ->invokeAfter ($ request , $ this ->resource )
813813 );
814814
815815 $ this
816816 ->collectFields ($ request )
817817 ->filter (
818- fn (Field $ field ) => in_array ($ field ->attribute , $ keys ),
818+ fn (Field $ field ) => in_array ($ field ->attribute , $ keys ),
819819 )
820820 ->forUpdate ($ request , $ this )
821821 ->withActions ($ request , $ this )
822822 ->authorizedPatch ($ request )
823- ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource ));
823+ ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource ));
824824
825825 return data ($ this ->serializeForShow ($ request ));
826826 }
@@ -841,7 +841,7 @@ public function updateBulk(RestifyRequest $request, $repositoryId, int $row)
841841 ->forUpdateBulk ($ request , $ this )
842842 ->withActions ($ request , $ this , $ row )
843843 ->authorizedUpdateBulk ($ request )
844- ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource , $ row ));
844+ ->each (fn (Field $ field ) => $ field ->actionHandler ->handle ($ request , $ this ->resource , $ row ));
845845
846846 return response ()->json ();
847847 }
@@ -866,7 +866,7 @@ public function attach(RestifyRequest $request, $repositoryId, Collection $pivot
866866 $ eagerField = $ this ->authorizeBelongsToMany ($ request )->belongsToManyField ($ request );
867867
868868 DB ::transaction (function () use ($ request , $ pivots , $ eagerField ) {
869- $ fields = $ eagerField ->collectPivotFields ()->filter (fn (
869+ $ fields = $ eagerField ->collectPivotFields ()->filter (fn (
870870 $ pivotField
871871 ) => $ request ->has ($ pivotField ->attribute ))->values ();
872872
@@ -910,7 +910,7 @@ public function detach(RestifyRequest $request, $repositoryId, Collection $pivot
910910
911911 $ deleted = DB ::transaction (function () use ($ pivots , $ eagerField , $ request ) {
912912 return $ pivots
913- ->map (fn ($ pivot ) => $ eagerField ->authorizeToDetach ($ request , $ pivot ) && $ pivot ->delete ());
913+ ->map (fn ($ pivot ) => $ eagerField ->authorizeToDetach ($ request , $ pivot ) && $ pivot ->delete ());
914914 });
915915
916916 return data ($ deleted , 204 );
@@ -953,7 +953,7 @@ public function allowToAttach(RestifyRequest $request, Collection $attachers): s
953953 {
954954 $ methodGuesser = 'attach ' .Str::studly ($ request ->relatedRepository );
955955
956- $ attachers ->each (fn ($ model ) => $ this ->authorizeToAttach ($ request , $ methodGuesser , $ model ));
956+ $ attachers ->each (fn ($ model ) => $ this ->authorizeToAttach ($ request , $ methodGuesser , $ model ));
957957
958958 return $ this ;
959959 }
@@ -971,7 +971,7 @@ public function allowToDetach(RestifyRequest $request, Collection $attachers): s
971971 {
972972 $ methodGuesser = 'detach ' .Str::studly ($ request ->relatedRepository );
973973
974- $ attachers ->each (fn ($ model ) => $ this ->authorizeToDetach ($ request , $ methodGuesser , $ model ));
974+ $ attachers ->each (fn ($ model ) => $ this ->authorizeToDetach ($ request , $ methodGuesser , $ model ));
975975
976976 return $ this ;
977977 }
@@ -1075,7 +1075,7 @@ public function serializeForShow(RestifyRequest $request): array
10751075 $ this ->request = $ request ;
10761076
10771077 return $ this ->filter ([
1078- 'id ' => $ this ->when (optional ($ this ->resource )?->getKey(), fn () => $ this ->getId ($ request )),
1078+ 'id ' => $ this ->when (optional ($ this ->resource )?->getKey(), fn () => $ this ->getId ($ request )),
10791079 'type ' => $ this ->when ($ type = $ this ->getType ($ request ), $ type ),
10801080 'attributes ' => $ request ->isShowRequest () ? $ this ->resolveShowAttributes ($ request ) : $ this ->resolveIndexAttributes ($ request ),
10811081 'relationships ' => $ this ->when (value ($ related = $ this ->resolveRelationships ($ request )), $ related ),
@@ -1141,7 +1141,7 @@ private function modelAttributes(?Request $request = null): Collection
11411141 */
11421142 protected static function fillFields (RestifyRequest $ request , Model $ model , Collection $ fields )
11431143 {
1144- return $ fields ->map (fn (Field $ field ) => $ field ->fillAttribute ($ request , $ model ));
1144+ return $ fields ->map (fn (Field $ field ) => $ field ->fillAttribute ($ request , $ model ));
11451145 }
11461146
11471147 protected static function fillBulkFields (
@@ -1208,14 +1208,14 @@ public function restifyjsSerialize(RestifyRequest $request): array
12081208 'match ' => static ::collectFilters ('matches ' ),
12091209 'searchables ' => static ::collectFilters ('searchables ' ),
12101210 'actions ' => $ this ->resolveActions ($ request )
1211- ->filter (fn (mixed $ action ) => $ action instanceof Action)
1212- ->filter (fn (Action $ action ) => $ action ->isShownOnIndex (
1211+ ->filter (fn (mixed $ action ) => $ action instanceof Action)
1212+ ->filter (fn (Action $ action ) => $ action ->isShownOnIndex (
12131213 $ request ,
12141214 $ this
12151215 ))->values (),
12161216 'getters ' => $ this ->resolveGetters ($ request )
1217- ->filter (fn (mixed $ action ) => $ action instanceof Getter)
1218- ->filter (fn (Getter $ action ) => $ action ->isShownOnIndex (
1217+ ->filter (fn (mixed $ action ) => $ action instanceof Getter)
1218+ ->filter (fn (Getter $ action ) => $ action ->isShownOnIndex (
12191219 $ request ,
12201220 $ this
12211221 ))->values (),
0 commit comments