I am trying to count tickets based on different where conditions . I am using four different queries on the same model. Can I execute all of the calculations using just one query?
$openTickets = Ticket::where('status',1)->count(); $pending = Ticket::where('status',2)->count(); $unAssigned = Ticket::where('agent_id',null)->count(); $unResolved = Ticket::whereNotIn('status',[3,4])->count();