I have a Posts DB and a likes DB with the following structure:
Posts Table: item_id
Likes Table: item_id, like_id
How can I sort my posts by their amount of likes without adding a "likes" field to my Posts table?
The most efficient way would be database query with JOIN, GROUP BY and COUNT. Easier way is something like this: http://stackoverflow.com/questions/24208502/laravel-orderby-relationship-count
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community