mardi 11 septembre 2018

Laravel slice in collection

I've got this code in my Laravel 5.6 controller:

$ads = Advertisement::actives();

$ports = Port::filter($filters)
    ->actives()
    ->paginate(28);

I would like to add every 4th port one advertisement. How could I do this?

So result should be:

//Collection
[
   //Port,
   //Port,
   //Port,
   //Port
   //Advertisement
   //Port
   //Port
   //Port
   //Port
   //Advertisement

   //etc...
]



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

Aucun commentaire:

Enregistrer un commentaire