Skip to content

Commit 33ce28a

Browse files
committed
fix lang problem
1 parent 95e1825 commit 33ce28a

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

src/Filament/Resources/TypeResource.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ class TypeResource extends Resource
1818

1919
protected static ?string $navigationIcon = 'heroicon-o-tag';
2020

21+
22+
public static function getTranslatableLocales(): array
23+
{
24+
return filament('filament-types')->getLocals();
25+
}
26+
2127
public static function getNavigationLabel(): string
2228
{
2329
return trans('filament-types::messages.title');

src/Filament/Resources/TypeResource/Pages/ListTypes.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ public function getTitle(): string
1818

1919
protected static string $resource = TypeResource::class;
2020

21-
public static function getTranslatableLocales(): array
22-
{
23-
return ['en', 'ar'];
24-
}
25-
2621
protected function getHeaderActions(): array
2722
{
2823
return TypeResource\Actions\ManagePageActions::make($this);

src/FilamentTypesPlugin.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ public function getId(): string
5050

5151
public function register(Panel $panel): void
5252
{
53-
$panel->plugin(
54-
SpatieLaravelTranslatablePlugin::make()
55-
->defaultLocales($this->getLocals()),
56-
)
57-
->resources([
58-
TypeResource::class,
59-
]);
53+
if(!$panel->hasPlugin('spatie-laravel-translatable')) {
54+
$panel->plugin(
55+
SpatieLaravelTranslatablePlugin::make()
56+
->defaultLocales($this->getLocals()),
57+
);
58+
}
59+
60+
$panel->resources([
61+
TypeResource::class,
62+
]);
6063
}
6164

6265
public function boot(Panel $panel): void

0 commit comments

Comments
 (0)