I have a query like:
$results = Post::all();
For the sake of simplicity, let's say the output is this (by id
):
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
My website has a 5-column layout. I need to split/divide these results into 5 columns such that it ends up like this:
1 | 2 | 3 | 4 | 5
6 | 7 | 8 | 9 | 10
11 | 12 | 13 | 14 | 15
The 5 column layout is split like this (the total number of columns is 25):
<div class="row">
<div class="col-xs-5">
//
</div>
<div class="col-xs-5">
//
</div>
<div class="col-xs-5">
//
</div>
<div class="col-xs-5">
//
</div>
<div class="col-xs-5">
//
</div>
</div>
How can I split $results
up like this? Any way to make use of Laravel's Collection methods?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire