在我的代码中,我有一个嵌套的foreach
,但在运行时会显示此错误
这是我的代码:
@foreach ($product as $user)
<p>This is title {{ $user->title }}</p>
<p>This is category {{ $user->category }}</p>
<p>This is sub category {{ $user->sub_category }}</p>
@foreach ($product_image as $product_image)
<p>This is image {{ $product_image->p_image }}</p>
@endforeach
@endforeach
答案 0 :(得分:1)
第二个foreach应该是:
@foreach ($User->product_images as $product_image)
不是:
@foreach ($product_image as $product_image)