laravel eloquent sort query example
In this article, We will explain to you how to get sort data into the database using Orderby method(laravel eloquent sort query example). The laravel eloquent provides many types of eloquent methods. so we can easily get sort data(ascending or descending order) into the database using the Orderby eloquent method.
laravel eloquent order by asc
1 2 3 | $students = DB::table('students') ->orderBy('name', 'asc') ->get(); |
laravel eloquent order by desc
1 2 3 | $students = DB::table('students') ->orderBy('name', 'desc') ->get(); |
Please follow and like us: