Files
nuhodds_fi4/app/Filament/Imports/StatistikoImporter.php
T
2026-04-28 16:50:23 +02:00

53 lines
1.3 KiB
PHP

<?php
namespace App\Filament\Imports;
use App\Filament\Imports\Helper\ImportBenchmark;
use App\Filament\Imports\Helper\ImportEvents;
use App\Filament\Imports\Helper\ImportFixtures;
use App\Filament\Imports\Helper\ImportPlayer;
use App\Models\StatistikoImport;
class StatistikoImporter
{
public static float $benchmarkStartTime;
public static int $benchmarkStartMemory;
public static int $startRowCount;
public static int $startQueries;
public static function run($record): void
{
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('max_execution_time', -1);
$table = $record['data_type'];
$filePath = $record['file_name'];
$sport_id = $record['sport_id'];
ImportBenchmark::start($table);
switch ($record['data_type']) {
case 'player':
ImportPlayer::run($filePath);
break;
case 'events':
ImportEvents::run($filePath, $sport_id);
break;
case 'fixtures':
ImportFixtures::run($filePath, $sport_id);
break;
case 'events_player':
break;
}
StatistikoImport::where('id', $record->id)->update(['has_run' => 1]);
ImportBenchmark::end($table);
}
}