2017-07-18 57 views
1

我有这样的错误试图让非对象试图让非对象错误的性质

(View: C:\xampp\htdocs\DigitalStudio\resources\views\welcome.blade.php) 
in b1747510b3c408d907ba1958669ebd058ad57227.php (line 101) 

并指出了该行的属性这一行

<img src="/uploads/avatars/{{ Auth::User()->avatar }}" class="img-circle person" alt="Random Name" width="255" height="255"> 

有什么我的代码中有错误或错误?我在其他页面的个人资料,这是我的个人资料页图像标签

<img src="/uploads/avatars/{{ Auth::User()->avatar }}" style="width:150px; height:150px; float:left; border-radius:50%; margin-right:25px;"> 
+1

似乎'{{验证::用户() - >头像} }'没有头像数据 –

+0

id使用我的个人资料(管理)页面中的代码,它的工作原理,但是当我尝试把我的用户页面,它给了我错误 –

+0

检查之前得到Auth属性'if(Auth :: check()){'您已登录'; }' – Hari

回答

1

您应经常检查,如果用户进行身份验证:

@if (auth()->check()) 
    <img src="/uploads/avatars/{{ auth()->user()->avatar }}" style="width:150px; height:150px; float:left; border-radius:50%; margin-right:25px;"> 
@else 
    Please login 
@endif