Tabish
Tabish

Reputation: 161

Trying to get property 'name' of non-object in laravel 5.8

How to solve this error?

Trying to get property 'name' of non-object

{{ Auth::user()->name }}

Upvotes: 0

Views: 215

Answers (1)

STA
STA

Reputation: 34848

Without Auth::check(), you can use blade directives take a look

@guest
    // Show content if  unauthenticated
@endguest

@auth
    // The data only available for auth user
    {{ Auth::user()->name }}
@endauth

Upvotes: 1

Related Questions