Why I am getting error?

Posted 1 week 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.

Reply to

Use Markdown with GitHub-flavored code blocks.