PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

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.