$ordersByWeek = Order::select([
DB::raw('count(id) as quantity'),
DB::raw('week(created_at) as week'),
DB::raw('year(created_at) as year')
])
->groupBy(['year', 'week'])
->get()
->toArray();
hye, so I saw this query in the website, they only show the json format result. how to display the value in blade especially the quantity? ?
If you want collection instead of an array just remove ->toArray() get() is enough.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.