Getting custom resource page into navigation sidebar

How to add a custom created resource page (under Filament/ResourceName/Pages/, not the one under Filament/Pages/) to the sidebar navi?
class AdStatisticList extends ListRecords {
protected static ?string $navigationLabel = "XXX";
protected static bool $shouldRegisterNavigation = true;
class AdStatisticList extends ListRecords {
protected static ?string $navigationLabel = "XXX";
protected static bool $shouldRegisterNavigation = true;
has no effect. I thought about adding it via ServiceProvider:
public function panel(Panel $panel): Panel
{
return $panel
...
->navigationItems([
NavigationItem::make('Werbestatistik')->url(???)
])
...
}
public function panel(Panel $panel): Panel
{
return $panel
...
->navigationItems([
NavigationItem::make('Werbestatistik')->url(???)
])
...
}
but how to get the url of it (see ??? in the code? Tried
NavigationItem::make('Werbestatistik')->url(AdStatisticList::getUrl())
NavigationItem::make('Werbestatistik')->url(AdStatisticList::getUrl())
but this resulted in Call to a member function getId() on null error.
1 Reply
Patrick Boivin
Patrick Boivin16mo ago
Have you tried this?
NavigationItem::make('Werbestatistik')
->url(ResourceName::getUrl('index'))
NavigationItem::make('Werbestatistik')
->url(ResourceName::getUrl('index'))
Want results from more Discord servers?
Add your server