我们有一个从 laravel v 5.1 升级到 v 5.4 的项目,升级后出现许多问题和错误无论如何都有这个
Trying to get property of non-object for index.blade.php
这是代码
<tbody>
@foreach($routeFEmails as $routeFEmail)
<tr>
<td>{{ $routeFEmail->id }}</td>
<td>{{ $routeFEmail->routeF->id }} ({{ $routeFEmail->routeF->vessel_name }})</td>
<td>{{ $routeFEmail->creator->type }}: {{ $routeFEmail->creator->first_name }} {{ $routeFEmail->creator->last_name }}</td>
<td>{{ $routeFEmail->status }}</td>
<td>{{ $routeFEmail->created_at->format('Y-m-d H:i') }}</td>
</tr>
@endforeach
</tbody>
我检查模型,没有提到的值是 null 没有 NULL
我也做过
php artisan cache:clear
php artisan route:clear
php artisan view:clear
这是协控制器中的一个功能
public function index()
{
$routeFEmails = RouteFEmail::orderBy('id', 'desc')->paginate(10);
return view('backend.route_f_emails.index', compact('routeFEmails'));
}
我该如何解决这个问题?:(