custom menu

Hi, I'm trying to create a Custom Nav Menu to display a Resource, but I'm getting a missing parameter: tenant
Filament::serving(function () {
Filament::registerNavigationItems([
NavigationItem::make('Consulta')
->url(PatientResource::getUrl(Filament::getTenant().'index'), shouldOpenInNewTab: false)
->icon('heroicon-o-presentation-chart-line')
->activeIcon('heroicon-s-presentation-chart-line')
->group('Configuración')
->sort(3),
]);
});
Filament::serving(function () {
Filament::registerNavigationItems([
NavigationItem::make('Consulta')
->url(PatientResource::getUrl(Filament::getTenant().'index'), shouldOpenInNewTab: false)
->icon('heroicon-o-presentation-chart-line')
->activeIcon('heroicon-s-presentation-chart-line')
->group('Configuración')
->sort(3),
]);
});
How can I pass the tenant to the url ? thanks!
Solution:
try passing Closure to the url method ->url(fn()=>NavigationItem::getUrl('index',['tenant'=>Filament::getTenant()]), shouldOpenInNewTab: false)...
Jump to solution
5 Replies
ingmontoya
ingmontoyaOP12mo ago
up
Lara Zeus
Lara Zeus12mo ago
->url(NavigationItem::getUrl('index',['tenant'=>Filament::getTenant()]), shouldOpenInNewTab: false)
->url(NavigationItem::getUrl('index',['tenant'=>Filament::getTenant()]), shouldOpenInNewTab: false)
ingmontoya
ingmontoyaOP12mo ago
Hi @Lara Zeus thanks for your response, however
Filament::getTenant()
Filament::getTenant()
is returning null ( the method above is being used in AppServiceProvider)
Solution
Lara Zeus
Lara Zeus12mo ago
try passing Closure to the url method ->url(fn()=>NavigationItem::getUrl('index',['tenant'=>Filament::getTenant()]), shouldOpenInNewTab: false)
ingmontoya
ingmontoyaOP12mo ago
perfect, thank you!
Want results from more Discord servers?
Add your server