Support the ongoing development of →
Database Eloquent Packages
Last updated 2 years ago.


What would be a real world example that this would be used in?

Last updated 2 years ago.

An example can be a Blog or news site:

You can show a box with "Top posts": Most popular posts, Yesterday most read posts, Last week most popular posts, All time most popular posts, all of them ordered by the number of views each post has had in each period of time.

e.g.: Most Viewed right sidebar box

Or instead of showing top post links, you can paginate and order all of your post by some of the available date ranges, and have a menu in your site with: Yesterday most popular posts, etc

e.g. Today's most viewed main content

Last updated 2 years ago.

This is great, will try it in the next days.

Idea for a function, maybe already possible?

  • I fetch my items based on my own filters (eg. category, searchterm ...) and call a function on it to sort them by the polularity stats by day, week, month ...
Last updated 2 years ago.

Thanks for the idea, If I understood it right that is already possible. The main function can filter its results by any of the saved data fields in the Popularity model: available time ranges, Eloquent model name, etc, but as the returned result is an instance of


you can add your own filters too, and then get the results paginated or process them in any way.

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

marcanuy marcanuy Joined 3 Feb 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.