Files
nuhodds_fi4/app/Filament/Imports/StatistikoImporter.php
T
2026-10-22 16:02:27 +02:00

59 lines
1.5 KiB
PHP

<?php
namespace App\Filament\Imports;
use App\Filament\Imports\Helper\ImportBenchmark;
use App\Filament\Imports\Helper\ImportDetails;
use App\Filament\Imports\Helper\ImportEvents;
use App\Filament\Imports\Helper\ImportFixtures;
use App\Filament\Imports\Helper\ImportPlayer;
use App\Filament\Imports\Helper\ImportTeamsTournaments;
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(object $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;
ImportBenchmark::start($table);
switch ($record['data_type']) {
case 'details':
ImportDetails::run($filePath);
break;
case 'events':
ImportEvents::run($filePath);
break;
case 'fixtures':
ImportFixtures::run($filePath);
break;
case 'player':
ImportPlayer::run($filePath);
break;
case 'teams_tornaments':
ImportTeamsTournaments::run($filePath);
break;
}
StatistikoImport::query()->where('id', $record->id)->update(['has_run' => 1]);
ImportBenchmark::end($table);
}
}