Laravel Group por Created_at Data
//Laravel ⛳
DB::table('table_name')
->select('*',DB::raw('DATE(created_at) as date'))
->get()->groupBy('date');
Jaskaran
//Laravel ⛳
DB::table('table_name')
->select('*',DB::raw('DATE(created_at) as date'))
->get()->groupBy('date');
StockHistory::query()
->where('cost_center_id',$cost_center_id)
->where('material_id',$material_id)
->get()
->groupBy(function($item)
{
return $item->created_at->format('Y-m-d');
})->map(function($item, $key){
return $item->sum('quantity');
});