Try adding a seed
$products = Product::where('id',$id)->inRandomOrder('foobar')->paginate(10)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I want to show the data for one of my models in a random order, the easiest way was to write it like this:
$products = Product::where('id',$id)->inRandomOrder()->paginate(10);
Now, this work perfectly for the first page, but sometimes I see the same data in other pages. Is there a better way to get the desired result without duplicates ?
Try adding a seed
$products = Product::where('id',$id)->inRandomOrder('foobar')->paginate(10)
Please or to participate in this conversation.