laravellaravel-9laravel-controller

How to get currently logged in user email from controller


I am trying to get the email of the currently logged in user from one of my controller. I normally get the currently logged in user id from this = auth()->id()
But when I try to get the email the same way like this = auth()->email() it gives me an error. Is there something I did wrong ? How can I get the email of the currently logged in user from my controller?


Solution

  • just try auth()->user()->email