mercredi 8 juin 2016

Count of orders in last 24 by hour

I have an order table which has created_at and I was wondering how I can take the last 24 hours orders and group them by hour.

$hourlyOrders = Order::where('created_at', '>', Carbon::now()->subDays(1))->count();

I guess I then need to groupBy hour in some way? I just need a count of the hourly orders.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire