【发布时间】:2019-11-16 15:16:43
【问题描述】:
ErrorException (E_ERROR) 试图获取非对象的属性“标题” (看法: D:\xampp\htdocs\xampp\practice\freecode\resources\views\profiles\index.blade.php)
以前的例外情况
试图获取非对象 (0) 的属性“标题”
<div class="d-flex">
<div ><strong>{{ $user->posts->count() }}</strong> posts</div>
<div class="pl-5"><strong>23k</strong> followers</div>
<div class="pl-5"><strong>435</strong> following</div>
</div>
<div class="pt-4 font-weight-bold" ><strong>{{ $user->profile->title }}</strong></div>
<div>{{ $user->profile->description }}</div>
<div><a href="#">{{ $user->profile->url ??'N/A' }}</a></div>
</div>
</div>
<div class="row pt-5">
@foreach($user->posts as $post)
<div class="col-4" >
<img src="/storage/{{ $post->image }}" class="w-100">
</div>
@endforeach
发布后显示此错误。
【问题讨论】: