I want to sort a collection based on two criteria. In my project I have an ideas
table. Ideas
belongs to a campaign
, and also have a numeric status. So, for one of my reports I want to sort first for campaign, and then by status desc.
If it were SQL it would be like
SELECT * FROM IDEAS
ORDER BY campaign_id, status DESC
Now with the ORM I do
$ideas = idea()->sortBy('campaign_id')->get()
So, what is the correct way to get the same result as the SQL statement above?
(First I read this answer How to sort Laravel Eloquent ORM objects? but it only refers to one key)