order by model laravel code example
Example 1: laravel order by
$users = DB::table('users')
-> orderBy('name', 'desc')
-> get();
Example 2: sort laravel eloquent
$posts = Post::orderBy('id', 'DESC')->get();
$users = DB::table('users')
-> orderBy('name', 'desc')
-> get();
$posts = Post::orderBy('id', 'DESC')->get();