【发布时间】:2014-09-05 17:35:02
【问题描述】:
@foreach ($wishItems as $wishItem)
<?php $products = Product::find($wishItem->product_id)->get(); ?>
@foreach($products as $product)
@if($product->id == $wishItem->product_id)
Name: <a href="{{ URL::route('product', $product->id) }}"> {{ $product->title }} </a><br>
Price: {{ $product->price }} €<br>
<hr>
@endif
@endforeach
@endforeach
$wishItems 是发送到此视图的 var,没关系... $products = Product::find($wishItem->product_id)->get(); 我有问题.. 我收到错误:Call to a member function get() on a non-object .... 我尝试将 $wishItem->product_id 替换为数字,例如 3 [它存在于数据库中] 但同样...
【问题讨论】: