diff --git a/app/Console/Commands/DeleteUnusedFiles.php b/app/Console/Commands/DeleteUnusedFiles.php new file mode 100644 index 00000000..90598671 --- /dev/null +++ b/app/Console/Commands/DeleteUnusedFiles.php @@ -0,0 +1,37 @@ +toArray(); + + collect(Storage::disk('public')->allFiles('statistiko')) + ->reject(fn (string $file) => $file === '.gitignore') + ->reject(fn (string $file) => in_array($file, $tasks)) + ->each(fn ($file) => Storage::disk('public')->delete($file)); + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 25d3ca41..99168f36 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -12,7 +12,10 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule): void { + $schedule->command('delete:unused-files')->daily(); + $schedule->command('model:prune')->daily(); + // $schedule->command('inspire')->hourly(); } diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php index 6c7bd34d..82d4c2c0 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php @@ -28,6 +28,7 @@ class StatistikoImportForm FileUpload::make('file_name') ->label('Select File') + ->disk('public') ->directory('statistiko') ->visibility('public') ->required() diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php index 3ff7eb53..0f593303 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php @@ -69,12 +69,14 @@ class StatistikoImportsTable ->title('Import started') ), DeleteAction::make() + ->successNotificationTitle('File deleted') ->label('Delete file'), ]), ]) ->toolbarActions([ BulkActionGroup::make([ - DeleteBulkAction::make(), + DeleteBulkAction::make() + ->successNotificationTitle('Files deleted'), ]), ]); } diff --git a/app/Filament/Imports/StatistikoImporter.php b/app/Filament/Imports/StatistikoImporter.php index e7246c9d..56befa58 100644 --- a/app/Filament/Imports/StatistikoImporter.php +++ b/app/Filament/Imports/StatistikoImporter.php @@ -88,7 +88,7 @@ class StatistikoImporter { $now = now()->format('Y-m-d H:i:s'); - SimpleExcelReader::create(storage_path('app/private/'.$filePath)) + SimpleExcelReader::create(storage_path('app/public/'.$filePath)) ->getRows() ->chunk(1000) ->each(function (LazyCollection $chunk) use ($now) { @@ -131,7 +131,7 @@ class StatistikoImporter { $now = now()->format('Y-m-d H:i:s'); - SimpleExcelReader::create(storage_path('app/private/'.$filePath)) + SimpleExcelReader::create(storage_path('app/public/'.$filePath)) ->getRows() ->chunk(1000) ->each(function (LazyCollection $chunk) use ($now) { @@ -140,16 +140,43 @@ class StatistikoImporter foreach ($chunk as $row) { - $row = array_values($row); - dd($row); + // print_r($row); + $row = array_values($row); + + // dd($row); + /*** + [LEAGUE] => 1 + [HOME] => 2133 + [AWAY] => 3024 + [SS_STARTTIME_VALUE] => DateTimeImmutable Object ( [date] => 2022-08-05 18:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Vienna ) + [SS_SEASON_VALUE] => 2022/2023 + [GLS_H] => 0 + [GLS_A] => 0 + [CRN_H] => 3 + [CRN_A] => 6 + [FLS_H] => 5 + [FLS_A] => 8 + [OFS_H] => 0 + [OFS_A] => 2 + [SNT_H] => 2 + [SNT_A] => 1 + [TSH_H] => 11 + [TSH_A] => 13 + [CRD_H] => 1 + [CRD_A] => 1 + [EXPGOALSHOME_VALUE] => 1.6350036183338 + [EXPGOALSAWAY_VALUE] => 0.97303070109903 + [EXP_HANDICAP] => -0.66197291723478 + [EXP_TOTAL] => 2.6080343194328 + */ $data[] = [ 'sport_id' => 1, - 'league_id' => $row[1], - 'home_id' => $row[2], - 'away_id' => $row[3], - 'starttime' => Carbon::parse($row[4])->toDateTimeString(), - 'season' => $row[5], + 'league_id' => $row[0], + 'home_id' => $row[1], + 'away_id' => $row[2], + 'starttime' => Carbon::parse($row[3])->toIso8601String(), + 'season' => $row[4], 'gls_h' => $row[6], 'gls_a' => $row[7], 'crn_h' => $row[8], diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php new file mode 100644 index 00000000..fe122c9e --- /dev/null +++ b/app/Providers/EventServiceProvider.php @@ -0,0 +1,13 @@ +=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.36.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, { "name": "symfony/polyfill-php83", "version": "v1.36.0", @@ -8591,86 +8658,6 @@ ], "time": "2026-04-10T17:25:58+00:00" }, - { - "name": "symfony/polyfill-php84", - "version": "v1.36.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php84.git", - "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/88486db2c389b290bf87ff1de7ebc1e13e42bb06", - "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php84\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php84/tree/v1.36.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-04-10T18:47:49+00:00" - }, { "name": "symfony/polyfill-php85", "version": "v1.36.0", @@ -10461,16 +10448,16 @@ }, { "name": "laravel/pint", - "version": "v1.29.0", + "version": "v1.29.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "bdec963f53172c5e36330f3a400604c69bf02d39" + "reference": "0770e9b7fafd50d4586881d456d6eb41c9247a80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/bdec963f53172c5e36330f3a400604c69bf02d39", - "reference": "bdec963f53172c5e36330f3a400604c69bf02d39", + "url": "https://api.github.com/repos/laravel/pint/zipball/0770e9b7fafd50d4586881d456d6eb41c9247a80", + "reference": "0770e9b7fafd50d4586881d456d6eb41c9247a80", "shasum": "" }, "require": { @@ -10481,14 +10468,14 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.94.2", - "illuminate/view": "^12.54.1", - "larastan/larastan": "^3.9.3", - "laravel-zero/framework": "^12.0.5", + "friendsofphp/php-cs-fixer": "^3.95.1", + "illuminate/view": "^12.56.0", + "larastan/larastan": "^3.9.6", + "laravel-zero/framework": "^12.1.0", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.4.0", "pestphp/pest": "^3.8.6", - "shipfastlabs/agent-detector": "^1.1.0" + "shipfastlabs/agent-detector": "^1.1.3" }, "bin": [ "builds/pint" @@ -10525,7 +10512,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2026-03-12T15:51:39+00:00" + "time": "2026-04-20T15:26:14+00:00" }, { "name": "laravel/sail", @@ -13593,12 +13580,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.3" }, - "platform-dev": [], - "plugin-api-version": "2.6.0" + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/storage/app/public/statistiko/01KPQRH2RBVQ0GW9JRQYCWVYZA.xlsx b/storage/app/public/statistiko/01KPQRH2RBVQ0GW9JRQYCWVYZA.xlsx new file mode 100644 index 00000000..58216252 Binary files /dev/null and b/storage/app/public/statistiko/01KPQRH2RBVQ0GW9JRQYCWVYZA.xlsx differ diff --git a/storage/app/public/statistiko/01KPQSQZN334HJXXE3JBYTF05E.xlsx b/storage/app/public/statistiko/01KPQSQZN334HJXXE3JBYTF05E.xlsx new file mode 100644 index 00000000..485f0a1e Binary files /dev/null and b/storage/app/public/statistiko/01KPQSQZN334HJXXE3JBYTF05E.xlsx differ diff --git a/storage/app/public/statistiko/01KPQT5RRWMKV3WKNHV2A4S49B.xlsx b/storage/app/public/statistiko/01KPQT5RRWMKV3WKNHV2A4S49B.xlsx new file mode 100644 index 00000000..58216252 Binary files /dev/null and b/storage/app/public/statistiko/01KPQT5RRWMKV3WKNHV2A4S49B.xlsx differ