mardi 14 novembre 2017

How can I make an iteration then iterate the same object again after a break in Blade PHP (Laravel)

In my controller, I'm passing a Collection of 8 items:

$data['items'] = Item::orderBy('id','desc')->take(8)->get();

to the view. Using Blade, I want to break the collection in half and render each half in different positions:

@foreach($items as $item)
  // iterate "n" times (4 for example)
@endforeach

// some html...

@foreach($items as $item)
  // iterate the rest 4 items from the same object $items
@endforeach

How can I do this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2yDNM6s
via IFTTT

Aucun commentaire:

Enregistrer un commentaire