Get tenant on a custom NavigationItem
Hello,
I want to add a custom NavigationItem where I need to redirect users to a page in my app outside of Filament, I want to include the tenant id they are currently on with:
Filament::getTenant() doesn't work and request()->get('tenant'), doesn't work as well.
5 Replies
Filament::getTenant() doesn't work and request()->get('tenant'), doesn't work as well.I guess this is in a service provider. Tenant info is only available after middleware not on boot. Wrap your nav items in a Closure and you should be good.
@Dennis Koch Thanks for the tip, I tried but unfortunately this doesn't work, I tried to pass a closure in the FilamentServiceProvider
Solution
I guess you need to use a Closure for url then
->url(fn () => ...)
Ah yes it works thanks!
my bad haha
All good. Thought your solution works, too. Always forget it's not allowed in that place