orderby model laravel code example
Example 1: order By Asc in laravbel
->orderBy('id', 'DESC');
Example 2: laravel order by
$users = DB::table('users')
-> orderBy('name', 'desc')
-> get();
Example 3: eloquent model sort by ascending order
$posts = Post::orderBy('id', 'DESC')->get();
Example 4: laravel 6 orderby
$inquiries = Inquiry::all()->sortByDesc('created_at')->sortByDesc('Status')->values();
Example 5: laravel 8 orderby
$flights = App\Models\Flight::where('active', 1)
->orderBy('name', 'desc')
->take(10)
->get();