luddinus's avatar

Order by random with pagination

Hi.

I would like to show some photos in a random order.

The thing is that I would like to paginate those photos and not to repeat the ones which have been appeared.

One option is this (thx to @rodrigo.pera) : "persisting or caching this random order, and maybe once a day rebuilding it. The rebuilding step can be done by scheduling a custom artisan command."

What other options could be?

Thx.

0 likes
1 reply
jlrdw's avatar

Have your paginator skip around at random, simply put a custom paginator at bottom with next and previous, the user won't know they are not going to the actual next page. Have the next link call for a random page number, but always have the previous link actually return to the previous page the user was on. Should be fairly easy to work out with a little bit of juggling of some if statements in the controller.

2 likes

Please or to participate in this conversation.