Why I am getting error?

Posted 3 months ago by darrenchan

I am trying to print logged in user name. However, I am getting error Trying to get property 'name' of non-object. Any suggestion?

Here is my code-

echo "Welcome " . Auth::user()->name;

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