one way would be to just add a where clause that gets products which were created in the last x many days?
else you will have to create your own manual pagination (refer to docs, its not that hard)
Hi,
I'm trying to create a "recent products" page, with a paginator.
My naive attempt is Product::(somefilters)->paginate(10);
This works well, as in it paginates nicely in the view. However, it takes all products in my database that match the filters. For my "recently added" section, I'd like to return a maximum of 100 products, not however many were created in the last x days.
Adding a ->take(100) in my somefilters section doesn't help, because the paginate() method overrides that to provide its pagination.
What would be the best way to go?
Please or to participate in this conversation.