This is some sorting:
- I want to list 20 best posts based on "views".
- then, sort it based on "created_at".
How to do it?
Heres my current code (which work, but doesnt sort by "created_at"):
$this->data['today_post'] =
Posts::orderBy('views', 'desc')
->orderBy('created_at', 'desc')
->whereRaw('created_at >= NOW() - INTERVAL 1 DAY')
->limit(20)->get();