Skip to content

Commit a5cfad6

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents ef9c6e3 + 6f81926 commit a5cfad6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Models/Concerns/HasTitleMenuLabelTrait.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

src/Models/Page.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use Illuminate\Database\Eloquent\Model;
77
use Spatie\MediaLibrary\HasMedia;
88
use Statikbe\FilamentFlexibleContentBlockPages\Facades\FilamentFlexibleContentBlockPages;
9-
use Statikbe\FilamentFlexibleContentBlockPages\Models\Contracts\HasMenuLabel;
109
use Statikbe\FilamentFlexibleContentBlockPages\Models\Concerns\HasTitleMenuLabelTrait;
10+
use Statikbe\FilamentFlexibleContentBlockPages\Models\Contracts\HasMenuLabel;
1111
use Statikbe\FilamentFlexibleContentBlocks\Models\Concerns\HasAuthorAttributeTrait;
1212
use Statikbe\FilamentFlexibleContentBlocks\Models\Concerns\HasCodeTrait;
1313
use Statikbe\FilamentFlexibleContentBlocks\Models\Concerns\HasDefaultContentBlocksTrait;
@@ -89,5 +89,4 @@ public function getMorphClass()
8989
{
9090
return 'filament-flexible-content-block-pages::page';
9191
}
92-
9392
}

0 commit comments

Comments
 (0)