Complete the code to order users by their name in ascending order.
$users = User::orderBy('[1]')->get();
Ordering by 'name' sorts users alphabetically by their name.
Complete the code to group orders by their status.
$orders = Order::select('status', DB::raw('count(*) as total')) ->groupBy('[1]') ->get();
Grouping by 'status' groups orders by their status value.
Fix the error in ordering products by price descending.
$products = Product::orderBy('price', '[1]')->get();
Use 'desc' to order by descending price in Laravel.
Fill both blanks to order posts by created date descending and group by user_id.
$posts = Post::orderBy('[1]', '[2]') ->groupBy('user_id') ->get();
Order posts by 'created_at' descending, then group by 'user_id'.
Fill all three blanks to select category, count products, group by category, and order by count descending.
$result = Product::select('[1]', DB::raw('count(*) as [2]')) ->groupBy('[3]') ->orderBy('[2]', 'desc') ->get();
Select 'category', count products as 'total', group by 'category' and order by 'total' descending.
