wip import events

This commit is contained in:
salam committed 2026-06-10 17:54:01 +02:00
1 parent 52b4a79ac8
commit f7c6b222db
1 file changed
+49 -49
+49 -49
View File
@@ -13,7 +13,7 @@ class ImportEvents
{
$now = now()->format('Y-m-d H:i:s');
SimpleExcelReader::create(storage_path('app/public/' . $filePath))
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
->getRows()
->chunk(1000)
->each(function (LazyCollection $chunk) use ($now, $importmode) {
@@ -32,33 +32,33 @@ class ImportEvents
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])
StatistikoEvent::where('match_id', (int) $row[0])
->where('sport_id', (int) $row[1])
->where('league_id', (int) $row[2])
->where('home_id', (int) $row[3])
->where('away_id', (int) $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],
'season' => (int) $row[6],
'gls_h' => (int) $row[7],
'gls_a' => (int) $row[8],
'crn_h' => (int) $row[9],
'crn_a' => (int) $row[10],
'fls_h' => (int) $row[11],
'fls_a' => (int) $row[12],
'ofs_h' => (int) $row[13],
'ofs_a' => (int) $row[14],
'snt_h' => (int) $row[15],
'snt_a' => (int) $row[16],
'tsh_h' => (int) $row[17],
'tsh_a' => (int) $row[18],
'crd_h' => (int) $row[19],
'crd_a' => (int) $row[20],
'exp_home' => (float) $row[21],
'exp_away' => (float) $row[22],
'exp_handicap' => (float) $row[23],
'exp_total' => (float) $row[24],
'result_code' => $row[25], // w, d, l
'created_at' => $now,
'updated_at' => $now,
@@ -68,31 +68,31 @@ class ImportEvents
} else {
StatistikoEvent::insert(
[
'match_id' => $row[0],
'sport_id' => $row[1],
'league_id' => $row[2],
'home_id' => $row[3],
'away_id' => $row[4],
'match_id' => (int) $row[0],
'sport_id' => (int) $row[1],
'league_id' => (int) $row[2],
'home_id' => (int) $row[3],
'away_id' => (int) $row[4],
'starttime' => Carbon::parse($row[5])->toIso8601String(),
'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],
'season' => (int) $row[6],
'gls_h' => (int) $row[7],
'gls_a' => (int) $row[8],
'crn_h' => (int) $row[9],
'crn_a' => (int) $row[10],
'fls_h' => (int) $row[11],
'fls_a' => (int) $row[12],
'ofs_h' => (int) $row[13],
'ofs_a' => (int) $row[14],
'snt_h' => (int) $row[15],
'snt_a' => (int) $row[16],
'tsh_h' => (int) $row[17],
'tsh_a' => (int) $row[18],
'crd_h' => (int) $row[19],
'crd_a' => (int) $row[20],
'exp_home' => (float) $row[21],
'exp_away' => (float) $row[22],
'exp_handicap' => (float) $row[23],
'exp_total' => (float) $row[24],
'result_code' => $row[25], // w, d, l
'created_at' => $now,
'updated_at' => $now,