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