I have an orders table and need to combine multiple counts depending on specific conditions.
At the moment I have 3 queries :
$orderCount = Order::count(); $newOrderCount = Order::where('status', '=', 'new')->count(); $completedOrderCount = Order::where('status', '=', 'completed')->count(); How can this be combined into 1 query?