format('Y-m-d H:i:s'); SimpleExcelReader::create(storage_path('app/public/'.$filePath)) ->getRows() ->chunk(1000) ->each(function (LazyCollection $chunk) use ($now, $sport_id) { foreach ($chunk as $row) { $row = array_values($row); StatistikoEvent::where('sport_id', $sport_id) ->where('league_id', $row[0]) ->where('home_id', $row[1]) ->where('away_id', $row[2]) ->where('starttime', Carbon::parse($row[3])->toIso8601String()) ->update( [ 'season' => $row[4], 'gls_h' => $row[5], 'gls_a' => $row[6], 'crn_h' => $row[7], 'crn_a' => $row[8], 'fls_h' => $row[9], 'fls_a' => $row[10], 'ofs_h' => $row[11], 'ofs_a' => $row[12], 'snt_h' => $row[13], 'snt_a' => $row[14], 'tsh_h' => $row[15], 'tsh_a' => $row[16], 'crd_h' => $row[17], 'crd_a' => $row[18], 'expgoalshome_value' => $row[19], 'expgoalsaway_value' => $row[20], 'exp_handicap' => $row[21], 'exp_total' => $row[22], 'created_at' => $now, 'updated_at' => $now, ], ['upsert' => true], ); } }); } }