getRows() ->chunk(200) ->each(function (LazyCollection $chunk) use ($sport_id) { foreach ($chunk as $row) { $row = array_values($row); /* 0 => 87 1 => 3614 2 => 1491 3 => DateTimeImmutable @1777334400 {#2722 ▶} 4 => 0.90433699503783 5 => 1.035168989838 */ StatisticFixtures::updateOrCreate( [ 'sport_id' => (int) $sport_id, 'league_id' => (int) $row[0], 'home_id' => (int) $row[1], 'away_id' => (int) $row[2], 'starttime' => Carbon::parse($row[3])->toDateString(), ], ['exp_home' => (float) $row[4], 'exp_away' => (float) $row[5]] ); } }); } }