@@ -67,21 +67,21 @@ public function getRelation(Model $model): EloquentRelation
6767 public function fields (Request $ request ): array
6868 {
6969 return [
70- BelongsTo::make ($ this ->getRelatedName (), 'related ' , static fn (Pivot $ model ): BelongsToRelation => $ model ->belongsTo (
70+ BelongsTo::make ($ this ->getRelatedName (), 'related ' , static fn (Pivot $ model ): BelongsToRelation => $ model ->belongsTo (
7171 $ model ->getRelation ('related ' )::class,
7272 $ model ->getRelatedKey (),
7373 $ model ->getForeignKey (),
7474 'related '
75- )->withDefault ())->withRelatableQuery (fn (Request $ request , Builder $ query , Pivot $ model ): Builder => $ this ->resolveRelatableQuery ($ request , $ model ->pivotParent )
76- ->unless ($ this ->allowDuplicateRelations , fn (Builder $ query ): Builder => $ query ->whereNotIn (
75+ )->withDefault ())->withRelatableQuery (fn (Request $ request , Builder $ query , Pivot $ model ): Builder => $ this ->resolveRelatableQuery ($ request , $ model ->pivotParent )
76+ ->unless ($ this ->allowDuplicateRelations , fn (Builder $ query ): Builder => $ query ->whereNotIn (
7777 $ query ->getModel ()->getQualifiedKeyName (),
7878 $ this ->getRelation ($ model ->pivotParent )->select ($ query ->getModel ()->getQualifiedKeyName ())
7979 )))->hydrate (function (Request $ request , Pivot $ model , mixed $ value ): void {
80- $ model ->setAttribute (
81- $ this ->getRelation ($ model ->pivotParent )->getRelatedPivotKeyName (),
82- $ value
83- );
84- })->display (fn (Model $ model ): ?string => $ this ->resolveDisplay ($ model )),
80+ $ model ->setAttribute (
81+ $ this ->getRelation ($ model ->pivotParent )->getRelatedPivotKeyName (),
82+ $ value
83+ );
84+ })->display (fn (Model $ model ): ?string => $ this ->resolveDisplay ($ model )),
8585 ];
8686 }
8787
@@ -107,7 +107,7 @@ protected function resolveField(Request $request, Field $field): void
107107 }
108108
109109 if ($ field instanceof Relation) {
110- $ field ->resolveRouteKeyNameUsing (fn (): string => Str::of ($ field ->getRelationName ())->singular ()->ucfirst ()->prepend ($ this ->getRouteKeyName ())->value ());
110+ $ field ->resolveRouteKeyNameUsing (fn (): string => Str::of ($ field ->getRelationName ())->singular ()->ucfirst ()->prepend ($ this ->getRouteKeyName ())->value ());
111111 }
112112
113113 parent ::resolveField ($ request , $ field );
@@ -136,7 +136,7 @@ public function withPivotFields(Closure $callback): static
136136 $ field ->setModelAttribute ($ attribute )
137137 ->name ($ attribute )
138138 ->id ($ attribute )
139- ->value (fn (): mixed => $ related ->getRelation ($ this ->getRelation ($ model )->getPivotAccessor ())->getAttribute ($ key ));
139+ ->value (fn (): mixed => $ related ->getRelation ($ this ->getRelation ($ model )->getPivotAccessor ())->getAttribute ($ key ));
140140 });
141141
142142 return $ fields ;
@@ -162,7 +162,7 @@ public function mergePivotValues(array $value): array
162162 {
163163 $ value = array_is_list ($ value ) ? array_fill_keys ($ value , []) : $ value ;
164164
165- return array_map (fn (array $ pivot ): array => array_merge ($ this ->pivotValues , $ pivot ), $ value );
165+ return array_map (fn (array $ pivot ): array => array_merge ($ this ->pivotValues , $ pivot ), $ value );
166166 }
167167
168168 /**
0 commit comments