当您在控制器中将它们作为数据传递时,在您的Blade模板中,您应该将它们作为对象输出:
{{ $images[0]->id }}
{{ $images[0]->host_image->path }}
你可以使用这个命令:
{{ $images->first()->id }}
{{ $images->first()->host_image->first()>path }}
控制器
在您的操作中,您需要将数据传递给 Blade 视图:
return view('someview', compact('images'));//name of variable $images
视图
只需使用变量:
@foreach($image as $image)
{{-- Do Something --}}
@endForEach