ActiveService::whereBetween('updated_at', [$dateFrom, $dateTo])
->where('ter', '<>', null)
// ->get('created_at')
->chunk(5000, function($cs) use(&$tableDate) {
foreach ($cs as $value) {
$key = array_search(Carbon::parse($value->created_at)->format('d.m.Y'), $tableDate['days']);
$tableDate[0]['count_sales'][$key]++; // Подсчет покупок.
}
});