Getting Tenant details into custom navigation

I'm trying to add a custom navigation item to add a link to what is set as the tenant's Base Channel. But I can't seem to get access to the Filament::getTenant() function when adding the NavigationItems.

->navigationItems([
                NavigationItem::make('Edit Main Channel')
                    ->url(fn (): string => ChannelResource::getUrl('edit', [$record=Filament::getTenant()->baseChannel()]))
                    ->sort(2)
            ])


I get the error that Filament:getTenant() returns null.
But once inside a separate page, it works properly.
Was this page helpful?