Plugin with Auth that registers: Pages, Widgets, and Resources
I'm creating a plugin for the registration of modules. How do I get the authenticated user on the plugin?
I already tried the following:
auth()->check()
Auth::check()
Filament::getTenant()
These gave null and false
Thank you
2 Replies
The authenticated User probably can't be evaluated at the time in the lifecycle since everything there happens while the application is being scaffolded/booted.
So you may need to find another location.
Maybe in a middleware, event/listener, etc.
Here's my code where I add the discover of my modules.
This is from the Provider/FIlament/AdminPanelProvider.php