2015-11-20 48 views
1

有些人可以告诉我如何在Laravel 5视图中显示此数组的结果吗?Laravel 5 Array to View

RowCollection {#464 ▼ 
    #title: "Worksheet" 
    #items: array:3 [▼ 
    0 => CellCollection {#472 ▼ 
     #title: null 
     #items: array:2 [▼ 
     "name" => "Owen Kelley" 
     "age" => 29.0 
     ] 
    } 
    1 => CellCollection {#473 ▼ 
     #title: null 
     #items: array:2 [▼ 
     "name" => "Jim Jackson" 
     "age" => 50.0 
     ] 
    } 
    2 => CellCollection {#474 ▼ 
     #title: null 
     #items: array:2 [▼ 
     "name" => "Sally Anne" 
     "age" => 35.0 
     ] 
    } 
    ] 
} 

我一直在努力争取这么多年!

非常感谢。

+0

向我们展示你的控制器功能,您的视图名称,我们会帮助您。 – ihue

回答

2

你应该使用的foreach,例如:

在控制器/ routes.php文件:

return view('yourviewname')->with('elephants', 'elephants') 

在刀片观点:

@foreach($elephants as $elephant) 
{{ $elephant->name }} 
@endforeach