Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Laravel Eloquent query to pull the authors with the most posts connected by a hasMany relationship

Laravel Eloquent Query by Relationships

Needed this for a WordPress to Laravel conversion project I'm working on. For the footer I needed to pull the top authors, sorted by the number of posts associated with them. On the site, it's actually fonts, but posts makes more sense for most people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.