Skip to content

Commit

Permalink
Remove custom navigation registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Sep 6, 2024
1 parent 0a4d600 commit f1c278c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
18 changes: 1 addition & 17 deletions src/FilamentMailsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,7 @@ public function register(Panel $panel): void

public function boot(Panel $panel): void
{
Filament::serving(function () use ($panel) {
Filament::registerNavigationItems([
NavigationItem::make()
->group(__('Mails'))
->label('Mails')
->url(fn (): string => MailResource::getUrl('index'))
->icon('heroicon-o-envelope')
->isActiveWhen(fn (): bool => request()->routeIs('filament.' . $panel->getId() . '.resources.mails.*'))
->childItems([
NavigationItem::make()
->label('Events')
->url(fn (): string => EventResource::getUrl('index'))
->icon('heroicon-o-calendar')
->isActiveWhen(fn (): bool => request()->routeIs('filament.' . $panel->getId() . '.resources.events.*')),
]),
]);
});
//
}

public static function make(): static
Expand Down
15 changes: 9 additions & 6 deletions src/Resources/EventResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ class EventResource extends Resource

protected static bool $isScopedToTenant = false;

protected static bool $shouldRegisterNavigation = false;
protected static bool $shouldRegisterNavigation = true;

protected static ?string $navigationParentItem = 'Mails';

public static function getNavigationGroup(): ?string
{
return __('Mails');
}

public static function getNavigationLabel(): string
{
Expand All @@ -35,16 +42,12 @@ public static function getLabel(): ?string
return __('Events');
}


public static function getNavigationIcon(): string
{
return 'heroicon-o-calendar';
}

public static function shouldRegisterNavigation(): bool
{
return false;
}

public function getTitle(): string
{
return __('Events');
Expand Down
7 changes: 6 additions & 1 deletion src/Resources/MailResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ class MailResource extends Resource

protected static bool $isScopedToTenant = false;

protected static bool $shouldRegisterNavigation = false;
protected static bool $shouldRegisterNavigation = true;

public static function getNavigationGroup(): ?string
{
return __('Mails');
}

public static function getNavigationLabel(): string
{
Expand Down

0 comments on commit f1c278c

Please sign in to comment.