samedi 19 septembre 2015

paginate related model in laravel

This seems a simple problem but I can't find a solution for this.
I'm trying to paginate a related model this way:

$store=Store::findOrFail(1);
$reviews=$store->reviews()->whereRaw('comment IS NOT NULL')->simplePaginate();

$reviews will be an instance of LightWeightPaginator, but current page is set to 2, trying of changing page in view , is not working too.

I'm wondering how you paginate a relationship from a model.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire