Cannot get login user data

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

    }

This my Route

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

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

Reply to

Use Markdown with GitHub-flavored code blocks.