Skip to content

Commit

Permalink
Merge pull request #146 from ThijmenKort/main
Browse files Browse the repository at this point in the history
Make Navigation Item visible/unvisible
  • Loading branch information
bezhanSalleh authored Nov 16, 2022
2 parents 268a927 + d3d9fa4 commit 675b613
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/filament-shield.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

return [
'shield_resource' => [
'show_in_navigation' => true,
'slug' => 'shield/roles',
'navigation_sort' => -1,
'navigation_badge' => true,
Expand Down
5 changes: 5 additions & 0 deletions src/Resources/RoleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ public static function getPluralModelLabel(): string
return __('filament-shield::filament-shield.resource.label.roles');
}

protected static function shouldRegisterNavigation(): bool
{
return Utils::isResourceNavigationItemEnabled();
}

protected static function getNavigationGroup(): ?string
{
return Utils::isResourceNavigationGroupEnabled()
Expand Down
5 changes: 5 additions & 0 deletions src/Support/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public static function getResourceSlug(): string
return (string) config('filament-shield.shield_resource.slug');
}

public static function isResourceNavigationItemEnabled(): bool
{
return config('filament-shield.shield_resource.show_in_navigation', true);
}

public static function getResourceNavigationSort(): int
{
return config('filament-shield.shield_resource.navigation_sort');
Expand Down

0 comments on commit 675b613

Please sign in to comment.