diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php index 8a8a2694..fb0b01dc 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php @@ -53,6 +53,7 @@ class StatistikoImportsTable 'player' => 'Player', ]), ], layout: FiltersLayout::AboveContent) + ->filtersFormColumns(6) ->persistFiltersInSession() ->deferFilters(false) ->recordActions([ diff --git a/app/Filament/Imports/Helper/ImportMarcatori.php b/app/Filament/Imports/Helper/ImportMarcatori.php new file mode 100644 index 00000000..7f9b3216 --- /dev/null +++ b/app/Filament/Imports/Helper/ImportMarcatori.php @@ -0,0 +1,52 @@ +format('Y-m-d H:i:s'); + + SimpleExcelReader::create(storage_path('app/public/'.$filePath)) + ->getRows() + ->chunk(1000) + ->each(function (LazyCollection $chunk) use ($now) { + + foreach ($chunk as $row) { + + $row = array_values($row); + + StatistikoPlayer::where('player_id', $row[0]) + ->update( + [ + 'name' => $row[1], + 'birthdate' => Carbon::parse($row[2])->toDateString(), + 'height' => $row[3], + 'nationality' => $row[4], + 'position' => $row[5], + 'sport_radar_id' => $row[6], + 'id_squadra_tm' => $row[7], + 'full_name' => $row[8], + 'no_specialities' => $row[9], + 'rigorist' => $row[10], + 'national_team_id' => $row[11], + 'last_update' => Carbon::parse($row[12])->toDateString(), + 'league_code' => $row[13], + 'team_code' => $row[14], + 'team_name' => $row[15], + 'created_at' => $now, + 'updated_at' => $now, + ], + ['upsert' => true], + ); + + } + }); + } +} diff --git a/app/Models/StatistikoMarcatori.php b/app/Models/StatistikoMarcatori.php new file mode 100644 index 00000000..e6e851a4 --- /dev/null +++ b/app/Models/StatistikoMarcatori.php @@ -0,0 +1,77 @@ +index('match_id'); + $collection->index('player_id'); + }); + } + + public function down(): void + { + Schema::dropIfExists('marcatori'); + } +};