Want to use order by for multiple columns in Laravel 4? You can simply invoke orderBy() as many times as you need it. For instance:
1 2 3 | User::orderBy('name', 'DESC') ->orderBy('email', 'ASC') ->get(); |
Produces the following query:
1 | SELECT * FROM `users` ORDER BY `name` DESC, `email` ASC |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.