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');
});