current loggedin user laravel 1

current loggedin user laravel

$user = auth()->user();  print($user->id);print($user->name);print($user->email);

Here is what the above code is Doing:
1. We’re using the auth() helper to get the currently authenticated user.
2. We’re using the user() method to get the User instance for the authenticated user.
3. We’re using the id, name, and email properties to get the id, name, and email of the authenticated user.

Similar Posts