2016-08-21 12 views
0

を渡されていない私は、メソッド(顧客)での機能を持っています顧客の配列。ビューでLaravel 5.2アレイ

私は

@foreach($customers as $item) 
<tr> 
<td>{{ $item->customer }}</td> 
<td>{{ $item->address }}</td> 
<td>{{ $item->city }}</td> 
<td>{{ $item->postcode }}</td> 
</tr> 
@endforeach 

を持っているが、私は

Undefined property: stdClass::$customer 

ヘルプを取得しています!私はすべてを試しました...

答えて

0

withcompactの両方を使用する必要はありません。 ただ、それらの一方が十分で、これを試してみてください:

Route::get('/customers', function(){ 
    $customers = \App\Customer::all(); 
    return view('customers.index', compact('customers')); 
}); 
+0

示唆したように私は、ルート内の行を変更し、私はまだ正確に同じエラーがある - 未定義のプロパティ:stdClassの:: $の顧客を – Jim