Skip to content

Commit

Permalink
fix lang problem
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Nov 18, 2024
1 parent 95e1825 commit 33ce28a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/Filament/Resources/TypeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class TypeResource extends Resource

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


public static function getTranslatableLocales(): array
{
return filament('filament-types')->getLocals();
}

public static function getNavigationLabel(): string
{
return trans('filament-types::messages.title');
Expand Down
5 changes: 0 additions & 5 deletions src/Filament/Resources/TypeResource/Pages/ListTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public function getTitle(): string

protected static string $resource = TypeResource::class;

public static function getTranslatableLocales(): array
{
return ['en', 'ar'];
}

protected function getHeaderActions(): array
{
return TypeResource\Actions\ManagePageActions::make($this);
Expand Down
17 changes: 10 additions & 7 deletions src/FilamentTypesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ public function getId(): string

public function register(Panel $panel): void
{
$panel->plugin(
SpatieLaravelTranslatablePlugin::make()
->defaultLocales($this->getLocals()),
)
->resources([
TypeResource::class,
]);
if(!$panel->hasPlugin('spatie-laravel-translatable')) {
$panel->plugin(
SpatieLaravelTranslatablePlugin::make()
->defaultLocales($this->getLocals()),
);
}

$panel->resources([
TypeResource::class,
]);
}

public function boot(Panel $panel): void
Expand Down

0 comments on commit 33ce28a

Please sign in to comment.