From d5563154e04dc06e03960fe3a0255128bc52bde9 Mon Sep 17 00:00:00 2001 From: salam Date: Mon, 11 May 2026 08:19:25 +0200 Subject: [PATCH] fix player marcatori names --- _ide_helper_models.php | 24 ++--- app/Actions/Statistics/MedianVsMittelwert.md | 34 ------- .../Pages/CreateStatistikoDetail.php | 11 +++ .../Pages/EditStatistikoDetails.php | 19 ++++ .../Pages/ListStatistikoDetails.php | 30 +++++++ .../Schemas/StatistikoDetailForm.php | 38 ++++++++ .../StatistikoDetailResource.php | 52 +++++++++++ .../Tables/StatistikoDetailsTable.php | 50 +++++++++++ .../Schemas/StatistikoImportForm.php | 2 +- .../Tables/StatistikoImportsTable.php | 4 +- ...koPlayers.php => EditStatistikoPlayer.php} | 2 +- .../Pages/ListStatistikoPlayers.php | 13 +-- .../Schemas/StatistikoPlayerForm.php | 81 ++++++++++++----- .../StatistikoPlayerResource.php | 8 +- .../Tables/StatistikoPlayersTable.php | 45 ++++------ .../{ImportPersonal.php => ImportDetails.php} | 6 +- .../Imports/Helper/ImportMarcatori.php | 52 ----------- app/Filament/Imports/Helper/ImportPlayer.php | 90 +++++++++++++++++++ app/Filament/Imports/StatistikoImporter.php | 8 +- app/Models/StatistikoDetail.php | 42 +++++++++ app/Models/StatistikoMarcatori.php | 77 ---------------- app/Models/StatistikoPlayer.php | 90 ++++++++++++++----- ..._144452_create_sofa_score_events_table.php | 58 ------------ ...94204_create_statistic_fixtures_table.php} | 0 ...hp => 2026_04_20_085306_mongo_details.php} | 5 +- ....php => 2026_04_20_145255_mongo_event.php} | 0 ...hp => 2026_04_20_145257_mongo_players.php} | 6 +- 27 files changed, 508 insertions(+), 339 deletions(-) delete mode 100644 app/Actions/Statistics/MedianVsMittelwert.md create mode 100644 app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Pages/CreateStatistikoDetail.php create mode 100644 app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Pages/EditStatistikoDetails.php create mode 100644 app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Pages/ListStatistikoDetails.php create mode 100644 app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Schemas/StatistikoDetailForm.php create mode 100644 app/Filament/Clusters/StaticData/Resources/StatistikoDetails/StatistikoDetailResource.php create mode 100644 app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Tables/StatistikoDetailsTable.php rename app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/{EditStatistikoPlayers.php => EditStatistikoPlayer.php} (90%) rename app/Filament/Imports/Helper/{ImportPersonal.php => ImportDetails.php} (93%) delete mode 100644 app/Filament/Imports/Helper/ImportMarcatori.php create mode 100644 app/Filament/Imports/Helper/ImportPlayer.php create mode 100644 app/Models/StatistikoDetail.php delete mode 100644 app/Models/StatistikoMarcatori.php delete mode 100644 database/migrations/2026_03_06_144452_create_sofa_score_events_table.php rename database/migrations/{2026_04_28_075531_create_statistic_fixtures_table.php => 2026_04_17_094204_create_statistic_fixtures_table.php} (100%) rename database/migrations/{2026_04_20_085306_mongo_db_statistiko_player.php => 2026_04_20_085306_mongo_details.php} (79%) rename database/migrations/{2026_04_20_145255_mongo_db_statistiko_event.php => 2026_04_20_145255_mongo_event.php} (100%) rename database/migrations/{2026_05_10_160640_mongo_db_marcatori_table.php => 2026_04_20_145257_mongo_players.php} (75%) diff --git a/_ide_helper_models.php b/_ide_helper_models.php index 626f23ce..fa6033cf 100644 --- a/_ide_helper_models.php +++ b/_ide_helper_models.php @@ -1929,19 +1929,19 @@ namespace App\Models{ namespace App\Models{ /** * @property-read mixed $id - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer addHybridHas(\Illuminate\Database\Eloquent\Relations\Relation $relation, string $operator = '>=', string $count = 1, string $boolean = 'and', ?\Closure $callback = null) - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer aggregate($function = null, $columns = []) - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer getConnection() - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer insert(array $values) - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer insertGetId(array $values, $sequence = null) - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer newModelQuery() - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer newQuery() - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer query() - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer raw($value = null) - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer search(\MongoDB\Builder\Type\SearchOperatorInterface|array $operator, ?string $index = null, ?array $highlight = null, ?bool $concurrent = null, ?string $count = null, ?string $searchAfter = null, ?string $searchBefore = null, ?bool $scoreDetails = null, ?array $sort = null, ?bool $returnStoredSource = null, ?array $tracking = null) - * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoPlayer vectorSearch(string $index, string $path, array $queryVector, int $limit, bool $exact = false, \MongoDB\Builder\Type\QueryInterface|array $filter = [], ?int $numCandidates = null) + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail addHybridHas(\Illuminate\Database\Eloquent\Relations\Relation $relation, string $operator = '>=', string $count = 1, string $boolean = 'and', ?\Closure $callback = null) + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail aggregate($function = null, $columns = []) + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail getConnection() + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail insert(array $values) + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail insertGetId(array $values, $sequence = null) + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail newModelQuery() + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail newQuery() + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail query() + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail raw($value = null) + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail search(\MongoDB\Builder\Type\SearchOperatorInterface|array $operator, ?string $index = null, ?array $highlight = null, ?bool $concurrent = null, ?string $count = null, ?string $searchAfter = null, ?string $searchBefore = null, ?bool $scoreDetails = null, ?array $sort = null, ?bool $returnStoredSource = null, ?array $tracking = null) + * @method static \MongoDB\Laravel\Eloquent\Builder|StatistikoDetail vectorSearch(string $index, string $path, array $queryVector, int $limit, bool $exact = false, \MongoDB\Builder\Type\QueryInterface|array $filter = [], ?int $numCandidates = null) */ - class StatistikoPlayer extends \Eloquent {} + class StatistikoDetail extends \Eloquent {} } namespace App\Models{ diff --git a/app/Actions/Statistics/MedianVsMittelwert.md b/app/Actions/Statistics/MedianVsMittelwert.md deleted file mode 100644 index 10e06191..00000000 --- a/app/Actions/Statistics/MedianVsMittelwert.md +++ /dev/null @@ -1,34 +0,0 @@ -Median -Wikipedia -https://de.wikipedia.org › wiki › Median -Der Median der Messwerte einer Urliste ist derjenige Messwert, der genau „in der Mitte“ steht, wenn man die Messwerte der Größe nach sortiert. Beispielsweise ... -Weitere Fragen -Was sagt der Medianwert aus? - -Was ist der Unterschied von Median- und Mittelwert? - -Der Hauptunterschied liegt in der Berechnung und Robustheit: Der Durchschnitt (arithmetisches Mittel) summiert alle Werte und teilt durch deren Anzahl, ist aber anfällig für Ausreißer. Der Median ist der exakte Mittelwert einer sortierten Reihe; er teilt Daten in zwei Hälften und ist robuster gegenüber extremen Werten. -Hier sind die Details: - - Durchschnitt (Arithmetisches Mittel): - Berechnung: - - Summe aller Werte/ Anzahl der Werte - - Eigenschaft: Berücksichtigt jeden Datenpunkt. - Nachteil: Extremwerte (sehr hohe oder niedrige Zahlen) verzerren das Ergebnis stark. - Beispiel: Bei Einkommen von 1.000€, 1.500€, 2.000€ und 50.000€ liegt der Durchschnitt bei 13.625€, was nicht die Situation der Mehrheit widerspiegelt. - -Median (Zentralwert): - - Berechnung: Daten sortieren, der mittlere Wert ist der Median. Bei gerader Anzahl: Mittelwert der beiden mittleren Werte. - Eigenschaft: Teilt die Daten in zwei gleich große Hälften (50 % sind kleiner, 50 % größer). - Vorteil: Unempfindlich gegenüber Ausreißern (robust). - Beispiel: Im obigen Einkommensbeispiel (1.000, 1.500, 2.000, 50.000) ist der Median 1.750€ ( - (1.500 + 2.000)/2 (bei gerader Anzahle der Werte) - ), was die Situation besser repräsentiert. - -Wann was verwenden? - - Durchschnitt: Bei gleichmäßiger Verteilung ohne große Ausreißer. - Median: Bei ungleichmäßiger Verteilung (schiefe Verteilung), wie bei Einkommen oder Immobilienpreisen. \ No newline at end of file diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Pages/CreateStatistikoDetail.php b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Pages/CreateStatistikoDetail.php new file mode 100644 index 00000000..2358b60a --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Pages/CreateStatistikoDetail.php @@ -0,0 +1,11 @@ +icon('phosphor-trash') + ->requiresConfirmation() + ->color('danger') + ->action(function () { + StatistikoDetail::truncate(); + }), + CreateAction::make() + ->label('New') + ->icon('phosphor-plus'), + ]; + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Schemas/StatistikoDetailForm.php b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Schemas/StatistikoDetailForm.php new file mode 100644 index 00000000..29ef56f7 --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Schemas/StatistikoDetailForm.php @@ -0,0 +1,38 @@ +components([ + Grid::make([ + 'default' => 2, + 'xl' => 4, + ])->schema([ + TextInput::make('id_giocatore')->required(), + TextInput::make('giocatore')->required(), + TextInput::make('nome_completo'), + DatePicker::make('data_di_nascita'), + TextInput::make('altezza'), + TextInput::make('nazionalita'), + TextInput::make('posizione'), + TextInput::make('sport_radar_id'), + TextInput::make('id_squadra_tm'), + TextInput::make('rigorista'), + TextInput::make('national_team_id'), + DatePicker::make('data_aggiornamento'), + TextInput::make('league_code'), + TextInput::make('team_code'), + TextInput::make('team_name'), + ]), + ])->columns(1); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/StatistikoDetailResource.php b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/StatistikoDetailResource.php new file mode 100644 index 00000000..07840e62 --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/StatistikoDetailResource.php @@ -0,0 +1,52 @@ + ListStatistikoDetails::route('/'), + ]; + } + + public static function getNavigationBadge(): ?string + { + return parent::getEloquentQuery()->count(); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Tables/StatistikoDetailsTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Tables/StatistikoDetailsTable.php new file mode 100644 index 00000000..1c53ff89 --- /dev/null +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoDetails/Tables/StatistikoDetailsTable.php @@ -0,0 +1,50 @@ +poll('10sec') + ->striped() + ->defaultPaginationPageOption(8) + ->paginationPageOptions([8, 16, 24, 36]) + ->columns([ + Stack::make([ + TextColumn::make('player_id')->prefix('Id: ')->searchable()->color('success')->icon('phosphor-copy')->copyable(), + TextColumn::make('name')->searchable()->prefix('Name: ')->color('primary')->icon('phosphor-copy')->copyable(), + TextColumn::make('full_name')->color('gray')->searchable(), + TextColumn::make('birthdate')->date()->prefix('Birthdate: '), + TextColumn::make('height')->prefix('Height: ')->suffix(' cm'), + TextColumn::make('nationality')->prefix('Nationality: '), + TextColumn::make('position')->prefix('Position: '), + TextColumn::make('sport_radar_id')->searchable()->prefix('Sport Radar Id: ')->icon('phosphor-copy')->copyable(), + TextColumn::make('id_squadra_tm')->prefix('Team Id TM: '), + TextColumn::make('rigorist')->prefix('Rigorist: '), + TextColumn::make('national_team_id')->prefix('National Team Id: '), + TextColumn::make('last_update')->date()->prefix('Last Update: '), + TextColumn::make('created_at')->date()->prefix('Created: '), + TextColumn::make('updated_at')->date()->prefix('Updated: '), + // TextColumn::make('league_code')->prefix('League: '), + // TextColumn::make('team_code')->prefix('Team Code: '), + // TextColumn::make('team_name')->prefix('Team Name: '), + ]), + ]) + ->contentGrid([ + 'md' => 2, + 'xl' => 4, + ]) + ->recordActions([ + EditAction::make()->hiddenLabel(), + DeleteAction::make()->hiddenLabel(), + ]); + } +} diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php index 84d1d547..bcc16499 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Schemas/StatistikoImportForm.php @@ -17,7 +17,7 @@ class StatistikoImportForm ->required() ->allowHtml() ->options([ - 'personal' => 'Personals', + 'details' => 'Details', 'events' => 'Events', 'fixtures' => 'Fixtures', 'player' => 'Player', diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php index fb0b01dc..7e04c2ba 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoImports/Tables/StatistikoImportsTable.php @@ -28,10 +28,10 @@ class StatistikoImportsTable ->width('2rem') ->allowOptionsHtml() ->options([ - 'personal' => 'Personal', + 'details' => 'Details', 'events' => 'Events', 'fixtures' => 'Fixtures', - 'player' => 'Player', + 'player' => 'Player', ]), TextColumn::make('file_name_original') ->searchable() diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/EditStatistikoPlayers.php b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/EditStatistikoPlayer.php similarity index 90% rename from app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/EditStatistikoPlayers.php rename to app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/EditStatistikoPlayer.php index b71cb126..6b43ab7f 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/EditStatistikoPlayers.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/EditStatistikoPlayer.php @@ -6,7 +6,7 @@ use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlaye use Filament\Actions\DeleteAction; use Filament\Resources\Pages\EditRecord; -class EditStatistikoPlayers extends EditRecord +class EditStatistikoPlayer extends EditRecord { protected static string $resource = StatistikoPlayerResource::class; diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/ListStatistikoPlayers.php b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/ListStatistikoPlayers.php index 6526300c..875b9aab 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/ListStatistikoPlayers.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Pages/ListStatistikoPlayers.php @@ -3,8 +3,6 @@ namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages; use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource; -use App\Models\StatistikoPlayer; -use Filament\Actions\Action; use Filament\Actions\CreateAction; use Filament\Resources\Pages\ListRecords; @@ -15,16 +13,7 @@ class ListStatistikoPlayers extends ListRecords protected function getHeaderActions(): array { return [ - Action::make('truncate') - ->icon('phosphor-trash') - ->requiresConfirmation() - ->color('danger') - ->action(function () { - StatistikoPlayer::truncate(); - }), - CreateAction::make() - ->label('New') - ->icon('phosphor-plus'), + CreateAction::make(), ]; } } diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Schemas/StatistikoPlayerForm.php b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Schemas/StatistikoPlayerForm.php index 37edc04b..74e57424 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Schemas/StatistikoPlayerForm.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Schemas/StatistikoPlayerForm.php @@ -2,7 +2,6 @@ namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas; -use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\TextInput; use Filament\Schemas\Components\Grid; use Filament\Schemas\Schema; @@ -16,25 +15,67 @@ class StatistikoPlayerForm Grid::make([ 'default' => 2, 'xl' => 4, - ]) - ->schema([ - TextInput::make('id_giocatore')->required(), - TextInput::make('giocatore')->required(), - TextInput::make('nome_completo'), - DatePicker::make('data_di_nascita'), - TextInput::make('altezza'), - TextInput::make('nazionalita'), - TextInput::make('posizione'), - TextInput::make('sport_radar_id'), - TextInput::make('id_squadra_tm'), - TextInput::make('rigorista'), - TextInput::make('national_team_id'), - DatePicker::make('data_aggiornamento'), - TextInput::make('league_code'), - TextInput::make('team_code'), - TextInput::make('team_name'), - ]), - + ])->schema([ + TextInput::make('match_id'), + TextInput::make('player_id'), + TextInput::make('playersubstitute_id'), + TextInput::make('goals'), + TextInput::make('assists'), + TextInput::make('own_goals'), + TextInput::make('shots_on_target'), + TextInput::make('shots_off_target'), + TextInput::make('shots_blocked'), + TextInput::make('fouls'), + TextInput::make('was_fouled'), + TextInput::make('offsides'), + TextInput::make('possessions_lost'), + TextInput::make('total_tackles'), + TextInput::make('touches'), + TextInput::make('total_cross'), + TextInput::make('cross_done'), + TextInput::make('total_dribbles'), + TextInput::make('dribbles_won'), + TextInput::make('total_ground_duels'), + TextInput::make('total_ground_duels_won'), + TextInput::make('total_aerial_duels'), + TextInput::make('total_duels_aerial_won'), + TextInput::make('total_pass'), + TextInput::make('pass'), + TextInput::make('total_long_balls'), + TextInput::make('long_balls'), + TextInput::make('blocked_shots'), + TextInput::make('clearances'), + TextInput::make('dribbled_past'), + TextInput::make('hit_woodwork'), + TextInput::make('interceptions'), + TextInput::make('key_pass'), + TextInput::make('last_man_tackle'), + TextInput::make('dispossessed'), + TextInput::make('clearance_off_line'), + TextInput::make('bcc'), + TextInput::make('bcm'), + TextInput::make('errors_lead_to_a_goal'), + TextInput::make('errors_lead_to_a_shot'), + TextInput::make('penalty_committed'), + TextInput::make('penalty_miss'), + TextInput::make('penalty_save'), + TextInput::make('penalty_won'), + TextInput::make('saves'), + TextInput::make('saves_from_in_box'), + TextInput::make('total_runs_out'), + TextInput::make('runs_out'), + TextInput::make('punches'), + TextInput::make('good_high_claim'), + TextInput::make('minutes_played'), + TextInput::make('lineup'), + TextInput::make('minute_event_during_the_match'), + TextInput::make('type_event_during_the_match'), + TextInput::make('description_event_during_the_match'), + TextInput::make('subtype_event_during_the_match'), + TextInput::make('player_position'), + TextInput::make('playerrating_value'), + TextInput::make('tm_player_id'), + ]), ])->columns(1); } } diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php index dc989416..6d52f902 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/StatistikoPlayerResource.php @@ -16,17 +16,17 @@ class StatistikoPlayerResource extends Resource { protected static ?string $model = StatistikoPlayer::class; - protected static ?string $navigationLabel = 'Personal Detail'; + protected static ?string $navigationLabel = 'Player'; - protected static ?string $modelLabel = 'Personal Detail'; + protected static ?string $modelLabel = 'Player'; protected static string|UnitEnum|null $navigationGroup = 'Statistiko'; protected static ?string $cluster = StaticDataCluster::class; - protected static ?int $navigationSort = 4; + protected static ?int $navigationSort = 5; - protected static ?string $recordTitleAttribute = 'giocatore'; + protected static ?string $recordTitleAttribute = 'player.name'; public static function form(Schema $schema): Schema { diff --git a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Tables/StatistikoPlayersTable.php b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Tables/StatistikoPlayersTable.php index c88a2c7d..95747c54 100644 --- a/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Tables/StatistikoPlayersTable.php +++ b/app/Filament/Clusters/StaticData/Resources/StatistikoPlayers/Tables/StatistikoPlayersTable.php @@ -2,9 +2,9 @@ namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables; -use Filament\Actions\DeleteAction; +use Filament\Actions\BulkActionGroup; +use Filament\Actions\DeleteBulkAction; use Filament\Actions\EditAction; -use Filament\Tables\Columns\Layout\Stack; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -13,38 +13,23 @@ class StatistikoPlayersTable public static function configure(Table $table): Table { return $table - ->poll('10sec') - ->striped() - ->defaultPaginationPageOption(8) - ->paginationPageOptions([8, 16, 24, 36]) ->columns([ - Stack::make([ - TextColumn::make('player_id')->prefix('Id: ')->searchable()->color('success')->icon('phosphor-copy')->copyable(), - TextColumn::make('name')->searchable()->prefix('Name: ')->color('primary')->icon('phosphor-copy')->copyable(), - TextColumn::make('full_name')->color('gray')->searchable(), - TextColumn::make('birthdate')->date()->prefix('Birthdate: '), - TextColumn::make('height')->prefix('Height: ')->suffix(' cm'), - TextColumn::make('nationality')->prefix('Nationality: '), - TextColumn::make('position')->prefix('Position: '), - TextColumn::make('sport_radar_id')->searchable()->prefix('Sport Radar Id: ')->icon('phosphor-copy')->copyable(), - TextColumn::make('id_squadra_tm')->prefix('Team Id TM: '), - TextColumn::make('rigorist')->prefix('Rigorist: '), - TextColumn::make('national_team_id')->prefix('National Team Id: '), - TextColumn::make('last_update')->date()->prefix('Last Update: '), - TextColumn::make('created_at')->date()->prefix('Created: '), - TextColumn::make('updated_at')->date()->prefix('Updated: '), - // TextColumn::make('league_code')->prefix('League: '), - // TextColumn::make('team_code')->prefix('Team Code: '), - // TextColumn::make('team_name')->prefix('Team Name: '), - ]), + TextColumn::make('match_id')->searchable(), + TextColumn::make('player_id')->searchable(), + TextColumn::make('event.home.name')->searchable(), + TextColumn::make('event.away.name')->searchable(), + TextColumn::make('details.name')->searchable(), ]) - ->contentGrid([ - 'md' => 2, - 'xl' => 4, + ->filters([ + // ]) ->recordActions([ - EditAction::make()->hiddenLabel(), - DeleteAction::make()->hiddenLabel(), + EditAction::make(), + ]) + ->toolbarActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), ]); } } diff --git a/app/Filament/Imports/Helper/ImportPersonal.php b/app/Filament/Imports/Helper/ImportDetails.php similarity index 93% rename from app/Filament/Imports/Helper/ImportPersonal.php rename to app/Filament/Imports/Helper/ImportDetails.php index e3972b9e..5046f78c 100644 --- a/app/Filament/Imports/Helper/ImportPersonal.php +++ b/app/Filament/Imports/Helper/ImportDetails.php @@ -2,12 +2,12 @@ namespace App\Filament\Imports\Helper; -use App\Models\StatistikoPlayer; +use App\Models\StatistikoDetail; use Illuminate\Support\Carbon; use Illuminate\Support\LazyCollection; use Spatie\SimpleExcel\SimpleExcelReader; -class ImportPersonal +class ImportDetails { public static function run(string $filePath): void { @@ -22,7 +22,7 @@ class ImportPersonal $row = array_values($row); - StatistikoPlayer::where('player_id', $row[0]) + StatistikoDetail::where('player_id', $row[0]) ->update( [ 'name' => $row[1], diff --git a/app/Filament/Imports/Helper/ImportMarcatori.php b/app/Filament/Imports/Helper/ImportMarcatori.php deleted file mode 100644 index 7f9b3216..00000000 --- a/app/Filament/Imports/Helper/ImportMarcatori.php +++ /dev/null @@ -1,52 +0,0 @@ -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/Filament/Imports/Helper/ImportPlayer.php b/app/Filament/Imports/Helper/ImportPlayer.php new file mode 100644 index 00000000..9e2b1bd6 --- /dev/null +++ b/app/Filament/Imports/Helper/ImportPlayer.php @@ -0,0 +1,90 @@ +getRows() + ->chunk(1000) + ->each(function (LazyCollection $chunk) { + + foreach ($chunk as $row) { + + $row = array_values($row); + + StatistikoPlayer::where('match_id', $row[0]) + ->where('player_id', $row[1]) + ->update( + [ + 'playersubstitute_id' => $row[2], + 'goals' => $row[3], + 'assists' => $row[4], + 'own_goals' => $row[5], + 'shots_on_target' => $row[6], + 'shots_off_target' => $row[7], + 'shots_blocked' => $row[8], + 'fouls' => $row[9], + 'was_fouled' => $row[10], + 'offsides' => $row[11], + 'possessions_lost' => $row[12], + 'total_tackles' => $row[13], + 'touches' => $row[14], + 'total_cross' => $row[15], + 'cross_done' => $row[16], + 'total_dribbles' => $row[17], + 'dribbles_won' => $row[18], + 'total_ground_duels' => $row[19], + 'total_ground_duels_won' => $row[20], + 'total_aerial_duels' => $row[21], + 'total_duels_aerial_won' => $row[22], + 'total_pass' => $row[23], + 'pass' => $row[24], + 'total_long_balls' => $row[25], + 'long_balls' => $row[26], + 'blocked_shots' => $row[27], + 'clearances' => $row[28], + 'dribbled_past' => $row[29], + 'hit_woodwork' => $row[30], + 'interceptions' => $row[31], + 'key_pass' => $row[32], + 'last_man_tackle' => $row[33], + 'dispossessed' => $row[34], + 'clearance_off_line' => $row[35], + 'bcc' => $row[36], + 'bcm' => $row[37], + 'errors_lead_to_a_goal' => $row[38], + 'errors_lead_to_a_shot' => $row[39], + 'penalty_committed' => $row[40], + 'penalty_miss' => $row[41], + 'penalty_save' => $row[42], + 'penalty_won' => $row[43], + 'saves' => $row[44], + 'saves_from_in_box' => $row[45], + 'total_runs_out' => $row[46], + 'runs_out' => $row[47], + 'punches' => $row[48], + 'good_high_claim' => $row[49], + 'minutes_played' => $row[50], + 'lineup' => $row[51], + 'minute_event_during_the_match' => $row[52], + 'type_event_during_the_match' => $row[53], + 'description_event_during_the_match' => $row[54], + 'subtype_event_during_the_match' => $row[55], + 'player_position' => $row[56], + 'playerrating_value' => $row[57], + 'tm_player_id' => $row[58], + ], + ['upsert' => true], + ); + + } + }); + } +} diff --git a/app/Filament/Imports/StatistikoImporter.php b/app/Filament/Imports/StatistikoImporter.php index 012b2f80..4f27bc6c 100644 --- a/app/Filament/Imports/StatistikoImporter.php +++ b/app/Filament/Imports/StatistikoImporter.php @@ -3,9 +3,10 @@ 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\ImportPersonal; +use App\Filament\Imports\Helper\ImportPlayer; use App\Models\StatistikoImport; class StatistikoImporter @@ -31,8 +32,8 @@ class StatistikoImporter ImportBenchmark::start($table); switch ($record['data_type']) { - case 'personal': - ImportPersonal::run($filePath); + case 'details': + ImportDetails::run($filePath); break; case 'events': ImportEvents::run($filePath); @@ -41,6 +42,7 @@ class StatistikoImporter ImportFixtures::run($filePath); break; case 'player': + ImportPlayer::run($filePath); break; } diff --git a/app/Models/StatistikoDetail.php b/app/Models/StatistikoDetail.php new file mode 100644 index 00000000..9040bb84 --- /dev/null +++ b/app/Models/StatistikoDetail.php @@ -0,0 +1,42 @@ + 'date', + 'last_update' => 'date', + ]; + } +} diff --git a/app/Models/StatistikoMarcatori.php b/app/Models/StatistikoMarcatori.php deleted file mode 100644 index e6e851a4..00000000 --- a/app/Models/StatistikoMarcatori.php +++ /dev/null @@ -1,77 +0,0 @@ - 'date', - 'last_update' => 'date', - ]; + return $this->belongsTo(StatistikoEvent::class, 'match_id', 'match_id'); + } + + public function details() + { + return $this->belongsTo(StatistikoDetail::class, 'player_id', 'player_id'); } } diff --git a/database/migrations/2026_03_06_144452_create_sofa_score_events_table.php b/database/migrations/2026_03_06_144452_create_sofa_score_events_table.php deleted file mode 100644 index 56098919..00000000 --- a/database/migrations/2026_03_06_144452_create_sofa_score_events_table.php +++ /dev/null @@ -1,58 +0,0 @@ -id(); - $table->integer('ss_event_id'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('sofa_score_events'); - } -}; - -// ss_event_id -// ss_season_name -// ss_season_value -// ss_starttime_value -// ss_hometeamactualscore_value -// ss_hometeamregulartimescore_value -// ss_awayteamactualscore_value -// ss_awayteamregulartimescore_value -// corner kicks - ft-h -// fouls - ft-h -// offsides - ft-h -// shots on target - ft-h -// total shots - ft-h -// yellow cards - ft-h -// corner kicks - ft-a -// fouls - ft-a -// offsides - ft-a -// shots on target - ft-a -// total shots - ft-a -// yellow cards - ft-a -// league_code -// league_hometeam_code -// league_awayteam_code -// date-home-away_code -// expgoalshome_value -// expgoalsaway_value -// exp handicap -// exp total -// update diff --git a/database/migrations/2026_04_28_075531_create_statistic_fixtures_table.php b/database/migrations/2026_04_17_094204_create_statistic_fixtures_table.php similarity index 100% rename from database/migrations/2026_04_28_075531_create_statistic_fixtures_table.php rename to database/migrations/2026_04_17_094204_create_statistic_fixtures_table.php diff --git a/database/migrations/2026_04_20_085306_mongo_db_statistiko_player.php b/database/migrations/2026_04_20_085306_mongo_details.php similarity index 79% rename from database/migrations/2026_04_20_085306_mongo_db_statistiko_player.php rename to database/migrations/2026_04_20_085306_mongo_details.php index f982b76c..7e400435 100644 --- a/database/migrations/2026_04_20_085306_mongo_db_statistiko_player.php +++ b/database/migrations/2026_04_20_085306_mongo_details.php @@ -11,10 +11,9 @@ return new class extends Migration /** * Player Details */ - public function up(): void { - Schema::create('player', function (Blueprint $collection) { + Schema::create('details', function (Blueprint $collection) { $collection->unique('player_id'); $collection->index('name'); }); @@ -22,6 +21,6 @@ return new class extends Migration public function down(): void { - Schema::dropIfExists('player'); + Schema::dropIfExists('details'); } }; diff --git a/database/migrations/2026_04_20_145255_mongo_db_statistiko_event.php b/database/migrations/2026_04_20_145255_mongo_event.php similarity index 100% rename from database/migrations/2026_04_20_145255_mongo_db_statistiko_event.php rename to database/migrations/2026_04_20_145255_mongo_event.php diff --git a/database/migrations/2026_05_10_160640_mongo_db_marcatori_table.php b/database/migrations/2026_04_20_145257_mongo_players.php similarity index 75% rename from database/migrations/2026_05_10_160640_mongo_db_marcatori_table.php rename to database/migrations/2026_04_20_145257_mongo_players.php index 13bc9485..f8eba2df 100644 --- a/database/migrations/2026_05_10_160640_mongo_db_marcatori_table.php +++ b/database/migrations/2026_04_20_145257_mongo_players.php @@ -9,11 +9,11 @@ return new class extends Migration protected $connection = 'mongodb'; /** - * Player Details + * Run the migrations. */ public function up(): void { - Schema::create('marcatori', function (Blueprint $collection) { + Schema::create('players', function (Blueprint $collection) { $collection->index('match_id'); $collection->index('player_id'); }); @@ -21,6 +21,6 @@ return new class extends Migration public function down(): void { - Schema::dropIfExists('marcatori'); + Schema::dropIfExists('players'); } };