【发布时间】:2018-04-10 08:02:56
【问题描述】:
问题是我如何将collections 打印到视图中。第一个 div 只打印 Collection 0 和下一个 Collection ++ 像这样
ExamsController@create
$collections = $questions->split(5);
$collections->toArray();
dd($collections);
dd($collections);
Collection {#455 ▼
#items: array:5 [▼
0 => Collection {#394 ▶}
1 => Collection {#619 ▶}
2 => Collection {#407 ▶}
3 => Collection {#398 ▶}
4 => Collection {#275 ▶}
]
}
Create.blade.php
<div>@foreach($collections as $collection)
集合 0
@endforeach</div>
<div>@foreach($collections as $collection)
集合 1
@endforeach</div>
<div>@foreach($collections as $collection)
系列 2
@endforeach</div>
<div>@foreach($collections as $collection)
系列 3
@endforeach</div>
<div>@foreach($collections as $collection)
系列 4
@endforeach</div>
【问题讨论】:
-
好的,请问有什么问题?
-
是的,我忘记了。正在写对不起。现在请检查一下