How we can paginate through random records in laravel? for example:
$products = Product::all()->orderBy(DB::raw('RAND()'));
$products->paginate(4);
$products->setPath('products');
Above will ends in duplicate records, because of random order. How can I persist the $products object so that, when a new page request made, it should filter though same/fixed random record set ?
Aucun commentaire:
Enregistrer un commentaire