4 years ago

Using Auth in service provider to get user object

Posted 4 years ago by reny410

I'm trying to get current user because I need to use view() helper function to share User object in all my views.

It doesn't seem to work, however, when I use Auth::user() in AppServiceProvider's boot method, it always returns null.

any idea why is this happening?
I don't really get what happens under the hood with these service provider, what things are accessible in my service provider?

Please sign in or create an account to participate in this conversation.