where('log_at', '>=', $startAt) ->where('log_at', '<', $endAt) ->groupBy('server_id', 'method') ->get() ->toArray(); foreach ($statistics as $statistic) { $statistic['record_type'] = 'm'; $statistic['record_at'] = $startAt; StatServerJob::dispatch($statistic); } } }