Reordering the sort order on queries in Laravel 7.x

1 · Amit Merchant · April 2, 2020, midnight
Often times, there comes a sceanrio where you’d want to alter the column through which you’ve setup your query to be sorted from. So, for instance, you’ve the following query. $query = DB::table('users')->orderBy('name'); Now, all you want to do is remove the sort order or just change the column for the soring to something else, what would you do? reorder() sort method Well, this #PR in Laravel 7.x actually tries to solve this particular problem. So, the PR adds a method called reorder() to the...