Cannot get login user data

Posted 2 months ago by sanjayacloud

Hi, I am try to get login user data. But I got "Trying to get property of non-object" error..

This my controller

 public function user(User $id)
        $id = Auth::user()->id;
        $profile = User::findOrFail($id);


This my Route

Route::get('/profile/{user}','[email protected]');

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.