This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Laravel 5.2 - Eloquent - How to order database SELECT results by multiple columns | |
| --------------------------------------------------------------------------------- | |
| Chain together using orderBy with the columns being sorted in the order they are chained, as in the example line below: | |
| $contents = ModelName::orderBy('columnA', 'asc')->orderBy('columnB', 'desc')->get(); | |
| If $contents is returned to the view now, all rows of the table will be sorted first according to the ascending values of | |
| columnA, followed by a second sort of the desc values of column B. |
NewerOlder