I want to get from database 10 random rows and then display it on paginate.
One page should display only 1 row and next button should display next row etc.
Also i have column that contains category id so for the first page i want to display row with cat_id = 1 for third page i want to display row that have cat_id = 3.
Please tell me is it possible? I have no idea how to do it.
For now i have controller:
$rows=Row::all()->random(10)->paginate(1);
And it says that there is no paginate method :(
Aucun commentaire:
Enregistrer un commentaire