@@ -11,17 +11,18 @@ trait HasTitleMenuLabelTrait
1111 public function getMenuLabel (?string $ locale = null ): string
1212 {
1313 $ locale = $ locale ?: app ()->getLocale ();
14-
14+
1515 // Check if the model uses translations (like Spatie Laravel Translatable)
1616 if (method_exists ($ this , 'getTranslation ' )) {
1717 $ title = $ this ->getTranslation ('title ' , $ locale );
1818 if (empty ($ title )) {
1919 // Fallback to the configured fallback locale
2020 $ title = $ this ->getTranslation ('title ' , config ('app.fallback_locale ' , 'en ' ));
2121 }
22+
2223 return $ title ?: 'Untitled ' ;
2324 }
24-
25+
2526 return $ this ->title ?: 'Untitled ' ;
2627 }
2728
@@ -33,16 +34,16 @@ public function scopeSearchForMenuItems($query, string $search)
3334 {
3435 return $ query ->where (function ($ query ) use ($ search ) {
3536 $ query ->where ('title ' , 'like ' , "% {$ search }% " );
36-
37+
3738 // Add additional searchable fields if they exist
3839 $ searchableFields = ['name ' , 'intro ' , 'description ' , 'overview_title ' ];
3940 foreach ($ searchableFields as $ field ) {
40- if (in_array ($ field , $ this ->getFillable ()) ||
41- (method_exists ($ this , 'getTranslatableAttributes ' ) &&
41+ if (in_array ($ field , $ this ->getFillable ()) ||
42+ (method_exists ($ this , 'getTranslatableAttributes ' ) &&
4243 in_array ($ field , $ this ->getTranslatableAttributes ()))) {
4344 $ query ->orWhere ($ field , 'like ' , "% {$ search }% " );
4445 }
4546 }
4647 });
4748 }
48- }
49+ }
0 commit comments