AdminPanelProvider auth() returns null.
I am trying to dynamically build a tenant menu based on tenant configuration data. However that is based on what the current user is assigned in the org. However I cannot access the current user via the auth() provider. I am also having issues access the current TenantID.
The only way I can seem to access the current user is with this code.
Please note that this is just some mock code to determine
'
Solution:Jump to solution
// THIS DOES NOT WORK, auth()->user() is nullYeah makes sense. ServiceProviders run way before any user is authenticated. You could use a middleware to modify that part of the app. You should be able to access the current panel by
Filament::getCurrentPanel()
and set the tenant menu items....2 Replies
Solution
// THIS DOES NOT WORK, auth()->user() is nullYeah makes sense. ServiceProviders run way before any user is authenticated. You could use a middleware to modify that part of the app. You should be able to access the current panel by
Filament::getCurrentPanel()
and set the tenant menu items.Ok, fair enough. I'll give that a try and see what happens
That worked