How to get Laravel model of authorized user?

Viewed 368

How can I get the user model in Laravel like this?

$userModel::find( auth()->id() );

I mean, auth user instance is already loaded, but in what above do we do the request to db...

2 Answers

You can just do:

auth()->user();

or using the Auth facade:

Auth::user();

You can get loggedIn user info like below

$user = auth()->user() ? auth()->user() : null;
Related