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
How can I split $results
up like this? Any way to make use of Laravel's Collection methods?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/29iVJSA
via IFTTT
Aucun commentaire:
Enregistrer un commentaire