我正在使用Laravel 5.5,我正在加载我的数据,如下所示:
public function details($id)
{
$instrument = Instruments::join('revisions', 'revisions.id', '=', 'instruments.revisions_id')
->where([
['revisions.revision_status', '=', '1'],
['instruments.id', '=', $id],
])
->orderBy('instruments.name')
->get();
$team = Team::join('instruments', 'teams.instruments_id', '=', 'instruments.id')
->join('revisions', 'revisions.id', '=', 'teams.revisions_id')
->where([
['revisions.revision_status', '=', '1'],
['instruments.id', '=', $id],
])
->orderBy('instruments.name')
->get();
return view('details')->with('instrumentUnderEdit', $instrument)->with('teamUnderEdit', $team);
}
但是,在我看来,我收到以下错误:
ErrorException thrown with message "Property [image] does not exist on this collection instance. (View: C:\Users\admin\Desktop\Projects\demo_laravel_screener\resources\views\details.blade.php)"
刀片文件具有以下变量:
<img style="height: 32px; width: 32px;" src="{{ asset('images')}}/{{ $instrumentUnderEdit->image }}" /> {{ $instrumentUnderEdit->name }}
为什么我收到错误的任何建议?我是否错误地将变量加载到视图中?
感谢您的回复!