fix player marcatori names

This commit is contained in:
salam committed 2026-05-11 08:19:25 +02:00
1 parent 3149fa6c12
commit d5563154e0
27 files changed
+507 -338

No files matched your search

+12 -12
View File
@@ -1929,19 +1929,19 @@ namespace App\Models{
namespace App\Models{ namespace App\Models{
/** /**
* @property-read mixed $id * @property-read mixed $id
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|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<static>|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<static>|StatistikoPlayer aggregate($function = null, $columns = []) * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail aggregate($function = null, $columns = [])
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoPlayer getConnection() * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail getConnection()
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoPlayer insert(array $values) * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail insert(array $values)
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoPlayer insertGetId(array $values, $sequence = null) * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail insertGetId(array $values, $sequence = null)
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoPlayer newModelQuery() * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail newModelQuery()
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoPlayer newQuery() * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail newQuery()
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoPlayer query() * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail query()
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoPlayer raw($value = null) * @method static \MongoDB\Laravel\Eloquent\Builder<static>|StatistikoDetail raw($value = null)
* @method static \MongoDB\Laravel\Eloquent\Builder<static>|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<static>|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<static>|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<static>|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{ namespace App\Models{
@@ -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.
@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages;
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\StatistikoDetailResource;
use Filament\Resources\Pages\CreateRecord;
class CreateStatistikoDetail extends CreateRecord
{
protected static string $resource = StatistikoDetailResource::class;
}
@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages;
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\StatistikoDetailResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditStatistikoDetails extends EditRecord
{
protected static string $resource = StatistikoDetailResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages;
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\StatistikoDetailResource;
use App\Models\StatistikoDetail;
use Filament\Actions\Action;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListStatistikoDetails extends ListRecords
{
protected static string $resource = StatistikoDetailResource::class;
protected function getHeaderActions(): array
{
return [
Action::make('truncate')
->icon('phosphor-trash')
->requiresConfirmation()
->color('danger')
->action(function () {
StatistikoDetail::truncate();
}),
CreateAction::make()
->label('New')
->icon('phosphor-plus'),
];
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Schemas;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Schema;
class StatistikoDetailForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->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);
}
}
@@ -0,0 +1,52 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails;
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Pages\ListStatistikoDetails;
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Schemas\StatistikoDetailForm;
use App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Tables\StatistikoDetailsTable;
use App\Filament\Clusters\StaticData\StaticDataCluster;
use App\Models\StatistikoDetail;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Table;
use UnitEnum;
class StatistikoDetailResource extends Resource
{
protected static ?string $model = StatistikoDetail::class;
protected static ?string $navigationLabel = 'Details';
protected static ?string $modelLabel = 'Details';
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
protected static ?string $cluster = StaticDataCluster::class;
protected static ?int $navigationSort = 4;
protected static ?string $recordTitleAttribute = 'giocatore';
public static function form(Schema $schema): Schema
{
return StatistikoDetailForm::configure($schema);
}
public static function table(Table $table): Table
{
return StatistikoDetailsTable::configure($table);
}
public static function getPages(): array
{
return [
'index' => ListStatistikoDetails::route('/'),
];
}
public static function getNavigationBadge(): ?string
{
return parent::getEloquentQuery()->count();
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Filament\Clusters\StaticData\Resources\StatistikoDetails\Tables;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\Layout\Stack;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class StatistikoDetailsTable
{
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: '),
]),
])
->contentGrid([
'md' => 2,
'xl' => 4,
])
->recordActions([
EditAction::make()->hiddenLabel(),
DeleteAction::make()->hiddenLabel(),
]);
}
}
@@ -17,7 +17,7 @@ class StatistikoImportForm
->required() ->required()
->allowHtml() ->allowHtml()
->options([ ->options([
'personal' => '<span class="text-blue-500">Personals</span>', 'details' => '<span class="text-blue-500">Details</span>',
'events' => '<span class="text-green-500">Events</span>', 'events' => '<span class="text-green-500">Events</span>',
'fixtures' => '<span class="text-orange-500">Fixtures</span>', 'fixtures' => '<span class="text-orange-500">Fixtures</span>',
'player' => '<span class="text-pink-600">Player</span>', 'player' => '<span class="text-pink-600">Player</span>',
@@ -28,10 +28,10 @@ class StatistikoImportsTable
->width('2rem') ->width('2rem')
->allowOptionsHtml() ->allowOptionsHtml()
->options([ ->options([
'personal' => '<span class="text-blue-500">Personal</span>', 'details' => '<span class="text-blue-500">Details</span>',
'events' => '<span class="text-green-500">Events</span>', 'events' => '<span class="text-green-500">Events</span>',
'fixtures' => '<span class="text-orange-500">Fixtures</span>', 'fixtures' => '<span class="text-orange-500">Fixtures</span>',
'player' => '<span class="text-amber-500">Player</span>', 'player' => '<span class="text-pink-600">Player</span>',
]), ]),
TextColumn::make('file_name_original') TextColumn::make('file_name_original')
->searchable() ->searchable()
@@ -6,7 +6,7 @@ use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlaye
use Filament\Actions\DeleteAction; use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
class EditStatistikoPlayers extends EditRecord class EditStatistikoPlayer extends EditRecord
{ {
protected static string $resource = StatistikoPlayerResource::class; protected static string $resource = StatistikoPlayerResource::class;
@@ -3,8 +3,6 @@
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages; namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource; use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
use App\Models\StatistikoPlayer;
use Filament\Actions\Action;
use Filament\Actions\CreateAction; use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
@@ -15,16 +13,7 @@ class ListStatistikoPlayers extends ListRecords
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
Action::make('truncate') CreateAction::make(),
->icon('phosphor-trash')
->requiresConfirmation()
->color('danger')
->action(function () {
StatistikoPlayer::truncate();
}),
CreateAction::make()
->label('New')
->icon('phosphor-plus'),
]; ];
} }
} }
@@ -2,7 +2,6 @@
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas; namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Grid; use Filament\Schemas\Components\Grid;
use Filament\Schemas\Schema; use Filament\Schemas\Schema;
@@ -16,25 +15,67 @@ class StatistikoPlayerForm
Grid::make([ Grid::make([
'default' => 2, 'default' => 2,
'xl' => 4, 'xl' => 4,
]) ])->schema([
->schema([ TextInput::make('match_id'),
TextInput::make('id_giocatore')->required(), TextInput::make('player_id'),
TextInput::make('giocatore')->required(), TextInput::make('playersubstitute_id'),
TextInput::make('nome_completo'), TextInput::make('goals'),
DatePicker::make('data_di_nascita'), TextInput::make('assists'),
TextInput::make('altezza'), TextInput::make('own_goals'),
TextInput::make('nazionalita'), TextInput::make('shots_on_target'),
TextInput::make('posizione'), TextInput::make('shots_off_target'),
TextInput::make('sport_radar_id'), TextInput::make('shots_blocked'),
TextInput::make('id_squadra_tm'), TextInput::make('fouls'),
TextInput::make('rigorista'), TextInput::make('was_fouled'),
TextInput::make('national_team_id'), TextInput::make('offsides'),
DatePicker::make('data_aggiornamento'), TextInput::make('possessions_lost'),
TextInput::make('league_code'), TextInput::make('total_tackles'),
TextInput::make('team_code'), TextInput::make('touches'),
TextInput::make('team_name'), 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); ])->columns(1);
} }
} }
@@ -16,17 +16,17 @@ class StatistikoPlayerResource extends Resource
{ {
protected static ?string $model = StatistikoPlayer::class; 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|UnitEnum|null $navigationGroup = 'Statistiko';
protected static ?string $cluster = StaticDataCluster::class; 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 public static function form(Schema $schema): Schema
{ {
@@ -2,9 +2,9 @@
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables; 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\Actions\EditAction;
use Filament\Tables\Columns\Layout\Stack;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
@@ -13,38 +13,23 @@ class StatistikoPlayersTable
public static function configure(Table $table): Table public static function configure(Table $table): Table
{ {
return $table return $table
->poll('10sec')
->striped()
->defaultPaginationPageOption(8)
->paginationPageOptions([8, 16, 24, 36])
->columns([ ->columns([
Stack::make([ TextColumn::make('match_id')->searchable(),
TextColumn::make('player_id')->prefix('Id: ')->searchable()->color('success')->icon('phosphor-copy')->copyable(), TextColumn::make('player_id')->searchable(),
TextColumn::make('name')->searchable()->prefix('Name: ')->color('primary')->icon('phosphor-copy')->copyable(), TextColumn::make('event.home.name')->searchable(),
TextColumn::make('full_name')->color('gray')->searchable(), TextColumn::make('event.away.name')->searchable(),
TextColumn::make('birthdate')->date()->prefix('Birthdate: '), TextColumn::make('details.name')->searchable(),
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([ ->filters([
'md' => 2, //
'xl' => 4,
]) ])
->recordActions([ ->recordActions([
EditAction::make()->hiddenLabel(), EditAction::make(),
DeleteAction::make()->hiddenLabel(), ])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]); ]);
} }
} }
@@ -2,12 +2,12 @@
namespace App\Filament\Imports\Helper; namespace App\Filament\Imports\Helper;
use App\Models\StatistikoPlayer; use App\Models\StatistikoDetail;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\LazyCollection; use Illuminate\Support\LazyCollection;
use Spatie\SimpleExcel\SimpleExcelReader; use Spatie\SimpleExcel\SimpleExcelReader;
class ImportPersonal class ImportDetails
{ {
public static function run(string $filePath): void public static function run(string $filePath): void
{ {
@@ -22,7 +22,7 @@ class ImportPersonal
$row = array_values($row); $row = array_values($row);
StatistikoPlayer::where('player_id', $row[0]) StatistikoDetail::where('player_id', $row[0])
->update( ->update(
[ [
'name' => $row[1], 'name' => $row[1],
@@ -1,52 +0,0 @@
<?php
namespace App\Filament\Imports\Helper;
use App\Models\StatistikoPlayer;
use Illuminate\Support\Carbon;
use Illuminate\Support\LazyCollection;
use Spatie\SimpleExcel\SimpleExcelReader;
class ImportMarcatori
{
public static function run(string $filePath): void
{
$now = now()->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],
);
}
});
}
}
@@ -0,0 +1,90 @@
<?php
namespace App\Filament\Imports\Helper;
use App\Models\StatistikoPlayer;
use Illuminate\Support\LazyCollection;
use Spatie\SimpleExcel\SimpleExcelReader;
class ImportPlayer
{
public static function run(string $filePath): void
{
SimpleExcelReader::create(storage_path('app/public/'.$filePath))
->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],
);
}
});
}
}
+5 -3
View File
@@ -3,9 +3,10 @@
namespace App\Filament\Imports; namespace App\Filament\Imports;
use App\Filament\Imports\Helper\ImportBenchmark; use App\Filament\Imports\Helper\ImportBenchmark;
use App\Filament\Imports\Helper\ImportDetails;
use App\Filament\Imports\Helper\ImportEvents; use App\Filament\Imports\Helper\ImportEvents;
use App\Filament\Imports\Helper\ImportFixtures; use App\Filament\Imports\Helper\ImportFixtures;
use App\Filament\Imports\Helper\ImportPersonal; use App\Filament\Imports\Helper\ImportPlayer;
use App\Models\StatistikoImport; use App\Models\StatistikoImport;
class StatistikoImporter class StatistikoImporter
@@ -31,8 +32,8 @@ class StatistikoImporter
ImportBenchmark::start($table); ImportBenchmark::start($table);
switch ($record['data_type']) { switch ($record['data_type']) {
case 'personal': case 'details':
ImportPersonal::run($filePath); ImportDetails::run($filePath);
break; break;
case 'events': case 'events':
ImportEvents::run($filePath); ImportEvents::run($filePath);
@@ -41,6 +42,7 @@ class StatistikoImporter
ImportFixtures::run($filePath); ImportFixtures::run($filePath);
break; break;
case 'player': case 'player':
ImportPlayer::run($filePath);
break; break;
} }
+42
View File
@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace App\Models;
use MongoDB\Laravel\Eloquent\Model;
class StatistikoDetail extends Model
{
protected $connection = 'mongodb';
protected $table = 'details';
protected $fillable = [
'player_id',
'name',
'full_name',
'birthdate',
'height',
'nationality',
'position',
'sport_radar_id',
'id_squadra_tm',
'rigorist',
'national_team_id',
'last_update',
'league_code',
'team_code',
'team_name',
'created_at',
'updated_at',
];
protected function casts(): array
{
return [
'birthdate' => 'date',
'last_update' => 'date',
];
}
}
-77
View File
@@ -1,77 +0,0 @@
<?php
namespace App\Models;
use MongoDB\Laravel\Eloquent\Model;
class StatistikoMarcatori extends Model
{
protected $connection = 'mongodb';
protected $table = 'marcatori';
protected $fillable = [
'match_id',
'player_id',
];
}
// match_id
// player_id
// playersubstitute_id
// goals
// assists
// own_goals
// shots_on_target
// shots_off_target
// shots_blocked
// fouls
// was_fouled
// offsides
// possessions_lost
// total_tackles
// touches
// total_cross
// cross_done
// total_dribbles
// dribbles_won
// total_ground_duels
// total_ground_duels_won
// total_aerial_duels
// total_duels_aerial_won
// total_pass
// pass
// total_long_balls
// long_balls
// blocked_shots
// clearances
// dribbled_past
// hit_woodwork
// interceptions
// key_pass
// last_man_tackle
// dispossessed
// clearance_off_line
// bcc
// bcm
// errors_lead_to_a_goal
// errors_lead_to_a_shot
// penalty_committed
// penalty_miss
// penalty_save
// penalty_won
// saves
// saves_from_in_box
// total_runs_out
// runs_out
// punches
// good_high_claim
// minutes_played
// lineup
// minute_event_during_the_match
// type_event_during_the_match
// description_event_during_the_match
// subtype_event_during_the_match
// player_position
// playerrating_value
// tm_player_id
+66 -24
View File
@@ -1,7 +1,5 @@
<?php <?php
declare(strict_types=1);
namespace App\Models; namespace App\Models;
use MongoDB\Laravel\Eloquent\Model; use MongoDB\Laravel\Eloquent\Model;
@@ -10,33 +8,77 @@ class StatistikoPlayer extends Model
{ {
protected $connection = 'mongodb'; protected $connection = 'mongodb';
protected $table = 'player'; protected $table = 'players';
protected $fillable = [ protected $fillable = [
'match_id',
'player_id', 'player_id',
'name', 'playersubstitute_id',
'full_name', 'goals',
'birthdate', 'assists',
'height', 'own_goals',
'nationality', 'shots_on_target',
'position', 'shots_off_target',
'sport_radar_id', 'shots_blocked',
'id_squadra_tm', 'fouls',
'rigorist', 'was_fouled',
'national_team_id', 'offsides',
'last_update', 'possessions_lost',
'league_code', 'total_tackles',
'team_code', 'touches',
'team_name', 'total_cross',
'created_at', 'cross_done',
'updated_at', 'total_dribbles',
'dribbles_won',
'total_ground_duels',
'total_ground_duels_won',
'total_aerial_duels',
'total_duels_aerial_won',
'total_pass',
'pass',
'total_long_balls',
'long_balls',
'blocked_shots',
'clearances',
'dribbled_past',
'hit_woodwork',
'interceptions',
'key_pass',
'last_man_tackle',
'dispossessed',
'clearance_off_line',
'bcc',
'bcm',
'errors_lead_to_a_goal',
'errors_lead_to_a_shot',
'penalty_committed',
'penalty_miss',
'penalty_save',
'penalty_won',
'saves',
'saves_from_in_box',
'total_runs_out',
'runs_out',
'punches',
'good_high_claim',
'minutes_played',
'lineup',
'minute_event_during_the_match',
'type_event_during_the_match',
'description_event_during_the_match',
'subtype_event_during_the_match',
'player_position',
'playerrating_value',
'tm_player_id',
]; ];
protected function casts(): array public function event()
{ {
return [ return $this->belongsTo(StatistikoEvent::class, 'match_id', 'match_id');
'birthdate' => 'date', }
'last_update' => 'date',
]; public function details()
{
return $this->belongsTo(StatistikoDetail::class, 'player_id', 'player_id');
} }
} }
@@ -1,58 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('sofa_score_events', function (Blueprint $table) {
$table->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
@@ -11,10 +11,9 @@ return new class extends Migration
/** /**
* Player Details * Player Details
*/ */
public function up(): void public function up(): void
{ {
Schema::create('player', function (Blueprint $collection) { Schema::create('details', function (Blueprint $collection) {
$collection->unique('player_id'); $collection->unique('player_id');
$collection->index('name'); $collection->index('name');
}); });
@@ -22,6 +21,6 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::dropIfExists('player'); Schema::dropIfExists('details');
} }
}; };
@@ -9,11 +9,11 @@ return new class extends Migration
protected $connection = 'mongodb'; protected $connection = 'mongodb';
/** /**
* Player Details * Run the migrations.
*/ */
public function up(): void public function up(): void
{ {
Schema::create('marcatori', function (Blueprint $collection) { Schema::create('players', function (Blueprint $collection) {
$collection->index('match_id'); $collection->index('match_id');
$collection->index('player_id'); $collection->index('player_id');
}); });
@@ -21,6 +21,6 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::dropIfExists('marcatori'); Schema::dropIfExists('players');
} }
}; };