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