dimanche 3 avril 2016

Chuck results from a query using model function

I have this code in my application :

$temoignages = $type->temoignages()->whereEtat('Actif')->get();
    foreach ($temoignages as $temoignage) {

        $str .= PHP_EOL.$temoignage['temoignage'].PHP_EOL.$temoignage->personne->prenom.' '.$temoignage->personne->nom;
    }

But I would like to get only 15 results from the query,. I tried to used "chunk" but it's not working on objects apparently.

Can someone help me ? Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire