reny410
1583
21
Laravel

Using Auth in service provider to get user object

Posted 3 years ago by reny410

Hello,
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.

Reply to

Use Markdown with GitHub-flavored code blocks.