This commit is contained in:
salam committed 2026-04-21 16:14:08 +02:00
1 parent 361f7fa822
commit 59897ca028
2 files changed
+5 -161

No files matched your search

+5 -4
View File
@@ -31,6 +31,7 @@ class StatistikoImporter
$table = $record['data_type'];
$filePath = $record['file_name'];
$sport_id = $record['sport_id'];
self::startBenchmark($table);
@@ -39,7 +40,7 @@ class StatistikoImporter
self::importPlayer($filePath);
break;
case 'events':
self::importEvents($filePath);
self::importEvents($filePath, $sport_id);
break;
case 'events_player':
break;
@@ -130,20 +131,20 @@ class StatistikoImporter
});
}
private static function importEvents(string $filePath): void
private static function importEvents(string $filePath, int $sport_id): void
{
$now = now()->format('Y-m-d H:i:s');
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
->getRows()
->chunk(1000)
->each(function (LazyCollection $chunk) use ($now) {
->each(function (LazyCollection $chunk) use ($now, $sport_id) {
foreach ($chunk as $row) {
$row = array_values($row);
StatistikoEvent::where('sport_id', 1)
StatistikoEvent::where('sport_id', $sport_id)
->where('league_id', $row[0])
->where('home_id', $row[1])
->where('away_id', $row[2])