@@ -59,15 +59,15 @@ protected static function createTaxonomyField(string $taxonomy, array $settings,
5959 }
6060
6161 $ model = app ($ modelClass );
62-
62+
6363 // Check if model is translatable
6464 if (method_exists ($ model , 'createWithTranslations ' )) {
6565 $ locale = app ()->getLocale ();
6666 $ translations = [
6767 $ locale => [
6868 'title ' => $ data ['title ' ],
6969 'slug ' => $ data ['slug ' ],
70- ]
70+ ],
7171 ];
7272 $ newTaxonomy = $ model ::createWithTranslations ([], $ translations );
7373 } else {
@@ -105,8 +105,10 @@ protected static function createTaxonomyField(string $taxonomy, array $settings,
105105 if (method_exists ($ item , 'translate ' )) {
106106 $ locale = request ()->query ('lang ' , app ()->getLocale ());
107107 $ translation = $ item ->translate ($ locale ) ?? $ item ->translate (app ()->getLocale ());
108- return [$ item ->id => $ translation ? $ translation ->title : 'ID: ' . $ item ->id ];
108+
109+ return [$ item ->id => $ translation ? $ translation ->title : 'ID: ' .$ item ->id ];
109110 }
111+
110112 return [$ item ->id => $ item ->title ];
111113 })
112114 ->toArray ()
@@ -128,8 +130,10 @@ protected static function createTaxonomyField(string $taxonomy, array $settings,
128130 if (method_exists ($ item , 'translate ' )) {
129131 $ locale = app ()->getLocale ();
130132 $ translation = $ item ->translate ($ locale );
131- return [$ item ->id => $ translation ? $ translation ->title : 'ID: ' . $ item ->id ];
133+
134+ return [$ item ->id => $ translation ? $ translation ->title : 'ID: ' .$ item ->id ];
132135 }
136+
133137 return [$ item ->id => $ item ->title ];
134138 })
135139 ->toArray ()
@@ -164,8 +168,10 @@ public static function getTaxonomyFilters(): array
164168 if (method_exists ($ item , 'translate ' )) {
165169 $ locale = app ()->getLocale ();
166170 $ translation = $ item ->translate ($ locale );
167- return [$ item ->id => $ translation ? $ translation ->title : 'ID: ' . $ item ->id ];
171+
172+ return [$ item ->id => $ translation ? $ translation ->title : 'ID: ' .$ item ->id ];
168173 }
174+
169175 return [$ item ->id => $ item ->title ];
170176 })
171177 ->toArray ()
@@ -226,7 +232,7 @@ protected static function handleTaxonomies(Model $record, array $data): void
226232 foreach (array_keys ($ taxonomyService ->getTaxonomies ()) as $ taxonomy ) {
227233 if (isset ($ data [$ taxonomy ])) {
228234 $ relationshipName = $ taxonomyService ->getTaxonomyRelationship ($ taxonomy );
229-
235+
230236 // Use the relationship name from the taxonomy service
231237 if (method_exists ($ record , $ relationshipName )) {
232238 $ record ->$ relationshipName ()->sync ($ data [$ taxonomy ]);
0 commit comments