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?
Asked
Active
Viewed 269 times
-2

Website Testing
- 11
- 3
-
1Please read the documentation: https://laravel.com/docs/9.x/authentication#retrieving-the-authenticated-user and https://laravel.com/docs/9.x/helpers#method-auth. Also, there are _tons_ of questions on Stackoverflow about how to handle this already, such as the linked duplicate, https://stackoverflow.com/questions/45522428/how-to-get-current-user-id-in-laravel-5-4, https://stackoverflow.com/questions/65058617/laravel-8-how-do-we-get-authenticated-users-email-address, etc. – Tim Lewis Sep 23 '22 at 02:37