Question By
Unsolved

Sort by Post Likes

jess-wallace

Jun 2nd, 2018 08:59 AM

Hi,

I have the Ninja Media Script and I want to sort by Post-Likes, so whoever gets the most votes becomes the top?

What I'd like to do, is be able to break it down by day Monday and rank the top rated etc

Can anyone help?

mark

Jun 5th, 2018 07:03 AM

Ordering should be easy, you should be able to find the model used in the controller and there you would add something like this:

->orderByRaw('SELECT count(*) FROM postsOrLikes WHERE item_id = items.id')

Or something like that, it should get you started. However, not sure the exact models, controllers or table names.