F
Filamentβ€’2y ago
Husky110

Problems with getNavigationItems

Hi - I am trying to setup my custom navigation following the docs (https://filamentphp.com/docs/2.x/admin/navigation#advanced-navigation-customization). My code looks like this:
private function buildNavigation() : void
{
Filament::navigation(function (NavigationBuilder $navigationBuilder){
return $navigationBuilder->items([
NavigationItem::make('Dashboard')
->icon('heroicon-o-home')
->activeIcon('heroicon-o-home')
->isActiveWhen(fn (): bool => request()->routeIs('filament.pages.dashboard'))
->url(route('filament.pages.dashboard')),
ArticleResource::getNavigationItems(),
WarehouseResource::getNavigationItems(),
]);
});
}
private function buildNavigation() : void
{
Filament::navigation(function (NavigationBuilder $navigationBuilder){
return $navigationBuilder->items([
NavigationItem::make('Dashboard')
->icon('heroicon-o-home')
->activeIcon('heroicon-o-home')
->isActiveWhen(fn (): bool => request()->routeIs('filament.pages.dashboard'))
->url(route('filament.pages.dashboard')),
ArticleResource::getNavigationItems(),
WarehouseResource::getNavigationItems(),
]);
});
}
This works so far that I get the dashboard, but the others just seem to return nothing. Am I doing something wrong here (or missing something)? When I run the regular navigation-builder everything works fine tho...
Filament
Navigation - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
4 Replies
Vp
Vpβ€’2y ago
...ArticleResource::getNavigationItems() You forgot ...
Husky110
Husky110OPβ€’2y ago
what do those? I always read them as "etc." πŸ˜„
Patrick Boivin
Patrick Boivinβ€’2y ago
@husky110 search "PHP array unpacking"
Husky110
Husky110OPβ€’2y ago
ah okay - thank you! πŸ™‚
Want results from more Discord servers?
Add your server