Cannot get login user data

Posted 1 month 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);
        var_dump($profile);

    }

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

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.