Answers for "eloquent order by laravel 8"

PHP
2

laravel order by

$users = DB::table('users')
         -> orderBy('name', 'desc')
         -> get();
Posted by: Guest on March-09-2021
3

aravel 8 how to order by using eloquent orm

$posts = Post::orderBy('id', 'DESC')->get();
Posted by: Guest on August-20-2020
0

laravel find query

// Retrieve a model by its primary key...
$flight = AppModelsFlight::find(1);

// Retrieve the first model matching the query constraints...
$flight = AppModelsFlight::where('active', 1)->first();

// Shorthand for retrieving the first model matching the query constraints...
$flight = AppModelsFlight::firstWhere('active', 1);
Posted by: Guest on October-08-2020
0

laravel find query

return Destination::orderByDesc(
    Flight::select('arrived_at')
        ->whereColumn('destination_id', 'destinations.id')
        ->orderBy('arrived_at', 'desc')
        ->limit(1)
)->get();
Posted by: Guest on October-08-2020
0

laravel find query

$model = AppModelsFlight::where('legs', '>', 100)->firstOr(function () {
        // ...
});
Posted by: Guest on October-08-2020

Code answers related to "eloquent order by laravel 8"

Browse Popular Code Answers by Language