I have Orders table and status column in my DB, the status is stored as [1,2,3,4] which is corresponding at frontend to [issued, pending, on thew ay, delivered] now I need to get the count of each status between 2 dates,
Please Note : I need the count of each status like,
issued : 80 pending : 50 on the way : 20 delivered : 170
I tried below code but don't no how to accomplish my needs
$account = DB::table('order')
->whereBetween('created_at',[$fromdate, $todate])
->select(DB::raw('COUNT(order.status) as total'))
->get();
return response()->json($account,200);
Any help will be much appreciated