2014-04-22 5 views
0

내가보기에 객체 데이터를 노출 컨트롤러를 가지고 템플릿의 @foreach의 데이터를 사용할 수 없습니다 :더 이상

$artifacts = Artifact::with('product'); 
return View::make('index', compact('artifacts')); 

이 지난 주까지 잘 작동하는 데 사용됩니다. 몇 가지 이유로 지금은 템플릿 자체에서 데이터를 사용할 수 없습니다. 열망 로딩을 사용하는 경우

//this works 
<?php 
    print_r($artifacts->first()); 
?> 

//this doesnt 
@foreach ($artifacts as $artifact) 
<?php 
    print_r($artifact); 
?> 
@endforeach 

답변

3

, 당신은 실제 결과 집합 얻을 해야합니다.

$artifacts = Artifact::with('product')->get();