You don't want to be doing anything in the register method than relies on the entire app being bootstrapped; it is intended for binding classes into the container.
You should be able to use Auth in the boot() method.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When i use Auth::user() in my AppServiceProvider class register function. I got this error: Class hash does not exist ?? Hoh can i resolw it? I hav 5.4 laravel
Please or to participate in this conversation.