statistiko events
This commit is contained in:
1 parent
c1b5adb3a4
commit
3d9239737f
29 files changed
+466
-767
No files matched your search
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateStatistikoEvents extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = StatistikoEventsResource::class;
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditStatistikoEvents extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = StatistikoEventsResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||||
|
use App\Filament\Imports\StatistikoEventImporter;
|
||||||
|
use App\Models\StatistikoEvent;
|
||||||
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Actions\ImportAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListStatistikoEvents extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = StatistikoEventsResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Action::make('truncate')
|
||||||
|
->icon('phosphor-trash')
|
||||||
|
->requiresConfirmation()
|
||||||
|
->color('danger')
|
||||||
|
->action(function () {
|
||||||
|
StatistikoEvent::truncate();
|
||||||
|
}),
|
||||||
|
CreateAction::make()
|
||||||
|
->label('New')
|
||||||
|
->icon('phosphor-plus'),
|
||||||
|
ImportAction::make('importEvents')
|
||||||
|
->maxRows(200000)
|
||||||
|
->color('success')
|
||||||
|
->chunkSize(250)
|
||||||
|
->icon('phosphor-upload')
|
||||||
|
->label('Import')
|
||||||
|
->modalDescription('Max 20k rows per import, column separator: ";"')
|
||||||
|
->importer(StatistikoEventImporter::class),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Schemas;
|
||||||
|
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
|
class StatistikoEventsForm
|
||||||
|
{
|
||||||
|
public static function configure(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
DateTimePicker::make('starttime'),
|
||||||
|
TextInput::make('season'),
|
||||||
|
TextInput::make('gls_h'),
|
||||||
|
TextInput::make('gls_a'),
|
||||||
|
TextInput::make('crn_h'),
|
||||||
|
TextInput::make('fls_h'),
|
||||||
|
TextInput::make('ofs_h'),
|
||||||
|
TextInput::make('snt_h'),
|
||||||
|
TextInput::make('tsh_h'),
|
||||||
|
TextInput::make('crd_h'),
|
||||||
|
TextInput::make('crn_a'),
|
||||||
|
TextInput::make('fls_a'),
|
||||||
|
TextInput::make('ofs_a'),
|
||||||
|
TextInput::make('snt_a'),
|
||||||
|
TextInput::make('tsh_a'),
|
||||||
|
TextInput::make('crd_a'),
|
||||||
|
TextInput::make('expgoalshome_value'),
|
||||||
|
TextInput::make('expgoalsaway_value'),
|
||||||
|
TextInput::make('exp_handicap'),
|
||||||
|
TextInput::make('exp_total'),
|
||||||
|
])->columns(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages\ListStatistikoEvents;
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Schemas\StatistikoEventsForm;
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables\StatistikoEventsTable;
|
||||||
|
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||||
|
use App\Models\StatistikoEvent;
|
||||||
|
use BackedEnum;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class StatistikoEventsResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = StatistikoEvent::class;
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerball';
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Event';
|
||||||
|
|
||||||
|
protected static ?string $modelLabel = 'Events';
|
||||||
|
|
||||||
|
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
||||||
|
|
||||||
|
protected static ?string $cluster = StaticDataCluster::class;
|
||||||
|
|
||||||
|
public static function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return StatistikoEventsForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return StatistikoEventsTable::configure($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => ListStatistikoEvents::route('/'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationBadge(): ?string
|
||||||
|
{
|
||||||
|
return parent::getEloquentQuery()->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationBadgeColor(): ?string
|
||||||
|
{
|
||||||
|
return 'success';
|
||||||
|
}
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables;
|
||||||
|
|
||||||
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\DeleteBulkAction;
|
||||||
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Tables\Columns\IconColumn;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class StatistikoEventsTable
|
||||||
|
{
|
||||||
|
public static function configure(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->striped()
|
||||||
|
->columns([
|
||||||
|
IconColumn::make('sport_id')
|
||||||
|
->label('')
|
||||||
|
->icon(fn (string $state): string => match ($state) {
|
||||||
|
'1' => 'icon-soccerball',
|
||||||
|
}),
|
||||||
|
TextColumn::make('league.name')->searchable(),
|
||||||
|
TextColumn::make('home.name')->searchable(),
|
||||||
|
TextColumn::make('away.name')->searchable(),
|
||||||
|
TextColumn::make('starttime')->dateTime('d. m. Y H:i'),
|
||||||
|
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->recordActions([
|
||||||
|
EditAction::make(),
|
||||||
|
])
|
||||||
|
->toolbarActions([
|
||||||
|
BulkActionGroup::make([
|
||||||
|
DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateStatistikoPlayer extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = StatistikoPlayerResource::class;
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditStatistikoPlayers extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = StatistikoPlayerResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||||
|
use App\Filament\Imports\StatistikoPlayerImporter;
|
||||||
|
use App\Models\StatistikoPlayer;
|
||||||
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Actions\ImportAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListStatistikoPlayers extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = StatistikoPlayerResource::class;
|
||||||
|
|
||||||
|
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'),
|
||||||
|
ImportAction::make('importPlayer')
|
||||||
|
->maxRows(200000)
|
||||||
|
->color('success')
|
||||||
|
->chunkSize(250)
|
||||||
|
->icon('phosphor-upload')
|
||||||
|
->label('Import')
|
||||||
|
->modalDescription('Max 20k rows per import, column separator ";"')
|
||||||
|
->importer(StatistikoPlayerImporter::class),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Schemas;
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas;
|
||||||
|
|
||||||
use Filament\Forms\Components\DatePicker;
|
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;
|
||||||
|
|
||||||
class UbPlayerForm
|
class StatistikoPlayerForm
|
||||||
{
|
{
|
||||||
public static function configure(Schema $schema): Schema
|
public static function configure(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
+10
-10
@@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers;
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers;
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages\ListUbPlayers;
|
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages\ListStatistikoPlayers;
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\Schemas\UbPlayerForm;
|
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas\StatistikoPlayerForm;
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\Tables\UbPlayersTable;
|
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables\StatistikoPlayersTable;
|
||||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||||
use App\Models\UbPlayer;
|
use App\Models\StatistikoPlayer;
|
||||||
use BackedEnum;
|
use BackedEnum;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use UnitEnum;
|
use UnitEnum;
|
||||||
|
|
||||||
class UbPlayerResource extends Resource
|
class StatistikoPlayerResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = UbPlayer::class;
|
protected static ?string $model = StatistikoPlayer::class;
|
||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerplayer';
|
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerplayer';
|
||||||
|
|
||||||
@@ -33,18 +33,18 @@ class UbPlayerResource extends Resource
|
|||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
return UbPlayerForm::configure($schema);
|
return StatistikoPlayerForm::configure($schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return UbPlayersTable::configure($table);
|
return StatistikoPlayersTable::configure($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPages(): array
|
public static function getPages(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'index' => ListUbPlayers::route('/'),
|
'index' => ListStatistikoPlayers::route('/'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Tables;
|
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\EditAction;
|
use Filament\Actions\EditAction;
|
||||||
@@ -8,7 +8,7 @@ use Filament\Tables\Columns\Layout\Stack;
|
|||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
class UbPlayersTable
|
class StatistikoPlayersTable
|
||||||
{
|
{
|
||||||
public static function configure(Table $table): Table
|
public static function configure(Table $table): Table
|
||||||
{
|
{
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\UbEventResource;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
|
||||||
|
|
||||||
class CreateUbEvent extends CreateRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = UbEventResource::class;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\UbEventResource;
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use Filament\Resources\Pages\EditRecord;
|
|
||||||
|
|
||||||
class EditUbEvent extends EditRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = UbEventResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
DeleteAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\UbEventResource;
|
|
||||||
use App\Filament\Imports\UbEventImporter;
|
|
||||||
use Filament\Actions\Action;
|
|
||||||
use Filament\Actions\ImportAction;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
|
||||||
|
|
||||||
class ListUbEvents extends ListRecords
|
|
||||||
{
|
|
||||||
protected static string $resource = UbEventResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ImportAction::make('importPlayer')
|
|
||||||
->icon('phosphor-upload')
|
|
||||||
->color('success')
|
|
||||||
->label('Import')
|
|
||||||
->modalIcon('phosphor-file-csv')
|
|
||||||
->modalDescription('Separator ";"')
|
|
||||||
->modalHeading('Import events with player')
|
|
||||||
->importer(UbEventImporter::class)
|
|
||||||
->csvDelimiter(';')
|
|
||||||
->extraModalFooterActions([
|
|
||||||
Action::make('copy')
|
|
||||||
->tooltip('Copy header line')
|
|
||||||
->color('success')
|
|
||||||
->label('Copy')
|
|
||||||
->action(function ($livewire) {
|
|
||||||
$livewire->js('window.navigator.clipboard.writeText("league_id;home_id;away_id;starttime;player_id;home_away;home_ft;away_ft;home_ht;away_ht;Goals;assists;tackles;total_passes;passes_done;total_duels;duels_won;total_ground_duels;ground_duels_won;total_aerial_duels;aerial_duels_won;minutes_played;shots_on_target;shots_off_target;shots_blocked;total_dribble;dribble_done;position;rating;bcm;hw;pw;pm;possession_lost;fouls;was_fouled;offsides;date_acquisition");');
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Header copied successfully')
|
|
||||||
->success()
|
|
||||||
->send();
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Schemas;
|
|
||||||
|
|
||||||
use Filament\Forms\Components\Radio;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use Filament\Schemas\Components\Grid;
|
|
||||||
use Filament\Schemas\Components\Section;
|
|
||||||
use Filament\Schemas\Schema;
|
|
||||||
|
|
||||||
class UbEventForm
|
|
||||||
{
|
|
||||||
public static function configure(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return $schema
|
|
||||||
->components([
|
|
||||||
Section::make('Player Team')
|
|
||||||
->schema([
|
|
||||||
Radio::make('home_away')
|
|
||||||
->hiddenLabel()
|
|
||||||
->options([
|
|
||||||
'H' => 'Home',
|
|
||||||
'A' => 'Away',
|
|
||||||
]),
|
|
||||||
TextInput::make('rating')
|
|
||||||
->numeric()
|
|
||||||
->inputMode('decimal'),
|
|
||||||
])->columns(2),
|
|
||||||
Grid::make([
|
|
||||||
'default' => 2,
|
|
||||||
'md' => 3,
|
|
||||||
'xl' => 5,
|
|
||||||
])
|
|
||||||
->schema([
|
|
||||||
TextInput::make('home_ft'),
|
|
||||||
TextInput::make('away_ft'),
|
|
||||||
TextInput::make('home_ht'),
|
|
||||||
TextInput::make('away_ht'),
|
|
||||||
TextInput::make('goals'),
|
|
||||||
TextInput::make('assists'),
|
|
||||||
TextInput::make('tackles'),
|
|
||||||
TextInput::make('total_passes'),
|
|
||||||
TextInput::make('passes_done'),
|
|
||||||
TextInput::make('total_duels'),
|
|
||||||
TextInput::make('duels_won'),
|
|
||||||
TextInput::make('total_ground_duels'),
|
|
||||||
TextInput::make('ground_duels_won'),
|
|
||||||
TextInput::make('total_aerial_duels'),
|
|
||||||
TextInput::make('aerial_duels_won'),
|
|
||||||
TextInput::make('minutes_played'),
|
|
||||||
TextInput::make('shots_on_target'),
|
|
||||||
TextInput::make('shots_off_target'),
|
|
||||||
TextInput::make('shots_blocked'),
|
|
||||||
TextInput::make('total_dribble'),
|
|
||||||
TextInput::make('dribble_done'),
|
|
||||||
TextInput::make('position'),
|
|
||||||
TextInput::make('bcm'),
|
|
||||||
TextInput::make('hw'),
|
|
||||||
TextInput::make('pw'),
|
|
||||||
TextInput::make('pm'),
|
|
||||||
TextInput::make('possession_lost'),
|
|
||||||
TextInput::make('fouls'),
|
|
||||||
TextInput::make('was_fouled'),
|
|
||||||
TextInput::make('offsides'),
|
|
||||||
]),
|
|
||||||
|
|
||||||
])->columns(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 'total_passes',
|
|
||||||
// 'passes_done',
|
|
||||||
// 'total_duels',
|
|
||||||
// 'duels_won',
|
|
||||||
// 'total_ground_duels',
|
|
||||||
// 'ground_duels_won',
|
|
||||||
// 'total_aerial_duels',
|
|
||||||
// 'aerial_duels_won',
|
|
||||||
// 'minutes_played',
|
|
||||||
// 'shots_on_target',
|
|
||||||
// 'shots_off_target',
|
|
||||||
// 'shots_blocked',
|
|
||||||
// 'total_dribble',
|
|
||||||
// 'dribble_done',
|
|
||||||
// 'position',
|
|
||||||
// 'rating',
|
|
||||||
// 'bcm',
|
|
||||||
// 'hw',
|
|
||||||
// 'pw',
|
|
||||||
// 'pm',
|
|
||||||
// 'possession_lost',
|
|
||||||
// 'fouls',
|
|
||||||
// 'was_fouled',
|
|
||||||
// 'offsides',
|
|
||||||
// 'date_acquisition',
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents\Tables;
|
|
||||||
|
|
||||||
use Filament\Actions\BulkActionGroup;
|
|
||||||
use Filament\Actions\DeleteBulkAction;
|
|
||||||
use Filament\Actions\EditAction;
|
|
||||||
use Filament\Forms\Components\DatePicker;
|
|
||||||
use Filament\Support\Enums\IconPosition;
|
|
||||||
use Filament\Tables\Columns\TextColumn;
|
|
||||||
use Filament\Tables\Enums\FiltersLayout;
|
|
||||||
use Filament\Tables\Filters\Filter;
|
|
||||||
use Filament\Tables\Filters\Indicator;
|
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
|
|
||||||
class UbEventsTable
|
|
||||||
{
|
|
||||||
public static function configure(Table $table): Table
|
|
||||||
{
|
|
||||||
return $table
|
|
||||||
->poll('10sec')
|
|
||||||
->striped()
|
|
||||||
->columns([
|
|
||||||
TextColumn::make('starttime')->dateTime('d. M. Y')->label('Date'),
|
|
||||||
TextColumn::make('league.name')->searchable(),
|
|
||||||
TextColumn::make('home.name')->searchable(),
|
|
||||||
TextColumn::make('away.name')->searchable(),
|
|
||||||
// TextColumn::make('player_id')->searchable(),
|
|
||||||
TextColumn::make('player.name')
|
|
||||||
->searchable()
|
|
||||||
->copyable()
|
|
||||||
->icon('phosphor-copy')
|
|
||||||
->iconPosition(IconPosition::After),
|
|
||||||
TextColumn::make('rating'),
|
|
||||||
])
|
|
||||||
->filters([
|
|
||||||
Filter::make('created_at')
|
|
||||||
->columns(2)->columnSpanFull()
|
|
||||||
->schema([
|
|
||||||
DatePicker::make('from'),
|
|
||||||
DatePicker::make('until'),
|
|
||||||
])
|
|
||||||
->query(function (Builder $query, array $data): Builder {
|
|
||||||
return $query
|
|
||||||
->when(
|
|
||||||
$data['from'],
|
|
||||||
fn (Builder $query, $date): Builder => $query->whereDate('starttime', '>=', $date),
|
|
||||||
)
|
|
||||||
->when(
|
|
||||||
$data['until'],
|
|
||||||
fn (Builder $query, $date): Builder => $query->whereDate('starttime', '<=', $date),
|
|
||||||
);
|
|
||||||
})
|
|
||||||
->indicateUsing(function (array $data): array {
|
|
||||||
$indicators = [];
|
|
||||||
|
|
||||||
if ($data['from'] ?? null) {
|
|
||||||
$indicators[] = Indicator::make('Starttime from '.Carbon::parse($data['from'])->toFormattedDateString())
|
|
||||||
->removeField('from');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($data['until'] ?? null) {
|
|
||||||
$indicators[] = Indicator::make('Starttime until '.Carbon::parse($data['until'])->toFormattedDateString())
|
|
||||||
->removeField('until');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $indicators;
|
|
||||||
}),
|
|
||||||
], layout: FiltersLayout::AboveContent)
|
|
||||||
->deferFilters(false)
|
|
||||||
->recordActions([
|
|
||||||
EditAction::make(),
|
|
||||||
])
|
|
||||||
->toolbarActions([
|
|
||||||
BulkActionGroup::make([
|
|
||||||
DeleteBulkAction::make(),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbEvents;
|
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\Pages\ListUbEvents;
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\Schemas\UbEventForm;
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbEvents\Tables\UbEventsTable;
|
|
||||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
|
||||||
use App\Models\UbEvent;
|
|
||||||
use BackedEnum;
|
|
||||||
use Filament\Resources\Resource;
|
|
||||||
use Filament\Schemas\Schema;
|
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
|
||||||
use UnitEnum;
|
|
||||||
|
|
||||||
class UbEventResource extends Resource
|
|
||||||
{
|
|
||||||
protected static ?string $model = UbEvent::class;
|
|
||||||
|
|
||||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerball';
|
|
||||||
|
|
||||||
protected static ?string $navigationLabel = 'Event & Player';
|
|
||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
|
||||||
|
|
||||||
protected static string|UnitEnum|null $navigationGroup = 'Statistiko';
|
|
||||||
|
|
||||||
protected static ?string $cluster = StaticDataCluster::class;
|
|
||||||
|
|
||||||
protected static ?string $modelLabel = 'Events & Players';
|
|
||||||
|
|
||||||
// public static function getPluralModelLabel(): string
|
|
||||||
// {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// protected static ?string $recordTitleAttribute = 'league_id';
|
|
||||||
|
|
||||||
public static function getRecordTitle($record): string|null|Htmlable
|
|
||||||
{
|
|
||||||
return ': '.$record->starttime->format('d. M. Y').' - '.$record->league->name.' - '.$record->home->name.' vs '.$record->away->name.' - '.$record->player->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
|
||||||
{
|
|
||||||
return UbEventForm::configure($schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
|
||||||
{
|
|
||||||
return UbEventsTable::configure($table);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPages(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'index' => ListUbEvents::route('/'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getNavigationBadge(): ?string
|
|
||||||
{
|
|
||||||
return parent::getEloquentQuery()->count();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getNavigationBadgeColor(): ?string
|
|
||||||
{
|
|
||||||
return 'success';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\UbPlayerResource;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
|
||||||
|
|
||||||
class CreateUbPlayer extends CreateRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = UbPlayerResource::class;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\UbPlayerResource;
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use Filament\Resources\Pages\EditRecord;
|
|
||||||
|
|
||||||
class EditUbPlayer extends EditRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = UbPlayerResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
DeleteAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Clusters\StaticData\Resources\UbPlayers\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Clusters\StaticData\Resources\UbPlayers\UbPlayerResource;
|
|
||||||
use App\Filament\Imports\UbPlayerImporter;
|
|
||||||
use App\Models\UbPlayer;
|
|
||||||
use Filament\Actions\Action;
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use Filament\Actions\ImportAction;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
|
||||||
|
|
||||||
class ListUbPlayers extends ListRecords
|
|
||||||
{
|
|
||||||
protected static string $resource = UbPlayerResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Action::make('truncate')
|
|
||||||
->icon('phosphor-trash')
|
|
||||||
->requiresConfirmation()
|
|
||||||
->color('danger')
|
|
||||||
->action(function () {
|
|
||||||
UbPlayer::truncate();
|
|
||||||
}),
|
|
||||||
CreateAction::make()
|
|
||||||
->label('New')
|
|
||||||
->icon('phosphor-plus'),
|
|
||||||
ImportAction::make('importPlayer')
|
|
||||||
->maxRows(200000)
|
|
||||||
->color('success')
|
|
||||||
->chunkSize(250)
|
|
||||||
->icon('phosphor-upload')
|
|
||||||
->label('Import')
|
|
||||||
->modalDescription('Max 20k rows per import, separator comma ","')
|
|
||||||
->importer(UbPlayerImporter::class),
|
|
||||||
// ->extraModalFooterActions([
|
|
||||||
// Action::make('copy')
|
|
||||||
// ->tooltip('Copy header line')
|
|
||||||
// ->color('success')
|
|
||||||
// ->label('Copy')
|
|
||||||
// ->action(function ($livewire) {
|
|
||||||
// $livewire->js('window.navigator.clipboard.writeText(\'"id giocatore", "giocatore", "data di nascita", "altezza", "nazionalita", "posizione", "sport radar id", "id squadra tm", "nome completo", "giocatore senza caratteri speciali", "rigorista", "national team id", "data aggiornamento", "league_code", "team_code", "team_name"\');');
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Header copied successfully')
|
|
||||||
// ->success()
|
|
||||||
// ->send();
|
|
||||||
// }),
|
|
||||||
// ]),
|
|
||||||
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Imports;
|
|
||||||
|
|
||||||
use App\Models\Player;
|
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
|
||||||
use Filament\Actions\Imports\Importer;
|
|
||||||
use Filament\Actions\Imports\Models\Import;
|
|
||||||
use Illuminate\Support\Number;
|
|
||||||
|
|
||||||
class PlayerImporter extends Importer
|
|
||||||
{
|
|
||||||
protected static ?string $model = Player::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ImportColumn::make('id')
|
|
||||||
->castStateUsing(function (string $state): ?int {
|
|
||||||
if (blank($state)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) $state;
|
|
||||||
})
|
|
||||||
->requiredMapping()
|
|
||||||
->numeric(),
|
|
||||||
ImportColumn::make('name')
|
|
||||||
->castStateUsing(function (string $state): ?string {
|
|
||||||
if (blank($state)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$state = preg_replace('@\([^\)]*\)$@', '', $state);
|
|
||||||
|
|
||||||
return trim($state);
|
|
||||||
})
|
|
||||||
->requiredMapping()
|
|
||||||
->rules(['required', 'max:255']),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resolveRecord(): Player
|
|
||||||
{
|
|
||||||
return Player::firstOrNew([
|
|
||||||
'id' => (int) $this->data['id'],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
|
||||||
{
|
|
||||||
$body = 'Your player import has completed and '.Number::format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
|
||||||
$body .= ' '.Number::format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
|
use App\Models\StatistikoEvent;
|
||||||
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
|
use Filament\Actions\Imports\Importer;
|
||||||
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use Illuminate\Support\Number;
|
||||||
|
|
||||||
|
class StatistikoEventImporter extends Importer
|
||||||
|
{
|
||||||
|
protected static ?string $model = StatistikoEvent::class;
|
||||||
|
|
||||||
|
public function resolveRecord(): StatistikoEvent
|
||||||
|
{
|
||||||
|
$res = StatistikoEvent::query()
|
||||||
|
->where('sport_id', $this->data['sport_id'])
|
||||||
|
->where('league_id', $this->data['league_id'])
|
||||||
|
->where('home_id', $this->data['home_id'])
|
||||||
|
->where('away_id', $this->data['away_id'])
|
||||||
|
->where('starttime', $this->data['starttime'])
|
||||||
|
->first();
|
||||||
|
if ($res) {
|
||||||
|
return StatistikoEvent::find($res->id);
|
||||||
|
} else {
|
||||||
|
return new StatistikoEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ImportColumn::make('sport_id')->numeric()->guess(['SPORT']),
|
||||||
|
ImportColumn::make('league_id')->numeric()->guess(['LEAGUE']),
|
||||||
|
ImportColumn::make('home_id')->numeric()->guess(['HOME']),
|
||||||
|
ImportColumn::make('away_id')->numeric()->guess(['AWAY']),
|
||||||
|
ImportColumn::make('starttime')
|
||||||
|
->guess(['STARTTIME'])
|
||||||
|
->castStateUsing(function ($state) {
|
||||||
|
return Carbon::parse($state);
|
||||||
|
}),
|
||||||
|
ImportColumn::make('season')->guess(['SEASON']),
|
||||||
|
ImportColumn::make('gls_h')->numeric(),
|
||||||
|
ImportColumn::make('gls_a')->numeric(),
|
||||||
|
ImportColumn::make('crn_h')->numeric(),
|
||||||
|
ImportColumn::make('fls_h')->numeric(),
|
||||||
|
ImportColumn::make('ofs_h')->numeric(),
|
||||||
|
ImportColumn::make('snt_h')->numeric(),
|
||||||
|
ImportColumn::make('tsh_h')->numeric(),
|
||||||
|
ImportColumn::make('crd_h')->numeric(),
|
||||||
|
ImportColumn::make('crn_a')->numeric(),
|
||||||
|
ImportColumn::make('fls_a')->numeric(),
|
||||||
|
ImportColumn::make('ofs_a')->numeric(),
|
||||||
|
ImportColumn::make('snt_a')->numeric(),
|
||||||
|
ImportColumn::make('tsh_a')->numeric(),
|
||||||
|
ImportColumn::make('crd_a')->numeric(),
|
||||||
|
ImportColumn::make('expgoalshome_value')
|
||||||
|
->castStateUsing(function (string $state) {
|
||||||
|
if (blank($state)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (float) str_replace(',', '.', $state);
|
||||||
|
}),
|
||||||
|
ImportColumn::make('expgoalsaway_value')
|
||||||
|
->castStateUsing(function (string $state) {
|
||||||
|
if (blank($state)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace(',', '.', $state);
|
||||||
|
}),
|
||||||
|
ImportColumn::make('exp_handicap')
|
||||||
|
->castStateUsing(function (string $state) {
|
||||||
|
if (blank($state)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace(',', '.', $state);
|
||||||
|
}),
|
||||||
|
ImportColumn::make('exp_total')
|
||||||
|
->castStateUsing(function (string $state) {
|
||||||
|
if (blank($state)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace(',', '.', $state);
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
{
|
||||||
|
$body = 'Your events import has completed and '.Number::format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||||
|
$body .= ' '.Number::format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
-7
@@ -2,31 +2,31 @@
|
|||||||
|
|
||||||
namespace App\Filament\Imports;
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
use App\Models\UbPlayer;
|
use App\Models\StatistikoPlayer;
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
use Filament\Actions\Imports\Importer;
|
use Filament\Actions\Imports\Importer;
|
||||||
use Filament\Actions\Imports\Models\Import;
|
use Filament\Actions\Imports\Models\Import;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Number;
|
use Illuminate\Support\Number;
|
||||||
|
|
||||||
class UbPlayerImporter extends Importer
|
class StatistikoPlayerImporter extends Importer
|
||||||
{
|
{
|
||||||
protected static ?string $model = UbPlayer::class;
|
protected static ?string $model = StatistikoPlayer::class;
|
||||||
|
|
||||||
public static function useDatabaseTransactions(): bool
|
public static function useDatabaseTransactions(): bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resolveRecord(): UbPlayer
|
public function resolveRecord(): StatistikoPlayer
|
||||||
{
|
{
|
||||||
$res = UbPlayer::query()
|
$res = StatistikoPlayer::query()
|
||||||
->where('id_giocatore', $this->data['id_giocatore'])
|
->where('id_giocatore', $this->data['id_giocatore'])
|
||||||
->first();
|
->first();
|
||||||
if ($res) {
|
if ($res) {
|
||||||
return UbPlayer::find($res->id);
|
return StatistikoPlayer::find($res->id);
|
||||||
} else {
|
} else {
|
||||||
return new UbPlayer;
|
return new StatistikoPlayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Imports;
|
|
||||||
|
|
||||||
use App\Models\UbEvent;
|
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
|
||||||
use Filament\Actions\Imports\Importer;
|
|
||||||
use Filament\Actions\Imports\Models\Import;
|
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
use Illuminate\Support\Number;
|
|
||||||
|
|
||||||
class UbEventImporter extends Importer
|
|
||||||
{
|
|
||||||
protected static ?string $model = UbEvent::class;
|
|
||||||
|
|
||||||
public function resolveRecord(): UbEvent
|
|
||||||
{
|
|
||||||
$res = UbEvent::query()
|
|
||||||
->where('league_id', $this->data['league_id'])
|
|
||||||
->where('home_id', $this->data['home_id'])
|
|
||||||
->where('away_id', $this->data['away_id'])
|
|
||||||
->where('player_id', $this->data['player_id'])
|
|
||||||
->where('starttime', $this->data['starttime'])
|
|
||||||
->first();
|
|
||||||
if ($res) {
|
|
||||||
return UbEvent::find($res->id);
|
|
||||||
} else {
|
|
||||||
return new UbEvent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ImportColumn::make('league_id')->numeric(),
|
|
||||||
ImportColumn::make('home_id')->numeric(),
|
|
||||||
ImportColumn::make('away_id')->numeric(),
|
|
||||||
ImportColumn::make('player_id')->numeric(),
|
|
||||||
ImportColumn::make('starttime')
|
|
||||||
->castStateUsing(function ($state) {
|
|
||||||
return Carbon::parse($state);
|
|
||||||
}),
|
|
||||||
ImportColumn::make('home_away')
|
|
||||||
->castStateUsing(function (string $state): ?string {
|
|
||||||
return (string) trim($state);
|
|
||||||
}),
|
|
||||||
ImportColumn::make('home_ft')->numeric(),
|
|
||||||
ImportColumn::make('away_ft')->numeric(),
|
|
||||||
ImportColumn::make('home_ht')->numeric(),
|
|
||||||
ImportColumn::make('away_ht')->numeric(),
|
|
||||||
ImportColumn::make('goals')->numeric(),
|
|
||||||
ImportColumn::make('assists')->numeric(),
|
|
||||||
ImportColumn::make('tackles')->numeric(),
|
|
||||||
ImportColumn::make('total_passes')->numeric(),
|
|
||||||
ImportColumn::make('passes_done')->numeric(),
|
|
||||||
ImportColumn::make('total_duels')->numeric(),
|
|
||||||
ImportColumn::make('duels_won')->numeric(),
|
|
||||||
ImportColumn::make('total_ground_duels')->numeric(),
|
|
||||||
ImportColumn::make('ground_duels_won')->numeric(),
|
|
||||||
ImportColumn::make('total_aerial_duels')->numeric(),
|
|
||||||
ImportColumn::make('aerial_duels_won')->numeric(),
|
|
||||||
ImportColumn::make('minutes_played')->numeric(),
|
|
||||||
ImportColumn::make('shots_on_target')->numeric(),
|
|
||||||
ImportColumn::make('shots_off_target')->numeric(),
|
|
||||||
ImportColumn::make('shots_blocked')->numeric(),
|
|
||||||
ImportColumn::make('total_dribble')->numeric(),
|
|
||||||
ImportColumn::make('dribble_done')->numeric(),
|
|
||||||
ImportColumn::make('position')
|
|
||||||
->castStateUsing(function (string $state): ?string {
|
|
||||||
return (string) trim($state);
|
|
||||||
}),
|
|
||||||
ImportColumn::make('rating')
|
|
||||||
->castStateUsing(function (string $state): ?string {
|
|
||||||
return (string) trim($state);
|
|
||||||
}),
|
|
||||||
ImportColumn::make('bcm')->numeric(),
|
|
||||||
ImportColumn::make('hw')->numeric(),
|
|
||||||
ImportColumn::make('pw')->numeric(),
|
|
||||||
ImportColumn::make('pm')->numeric(),
|
|
||||||
ImportColumn::make('possession_lost')->numeric(),
|
|
||||||
ImportColumn::make('fouls')->numeric(),
|
|
||||||
ImportColumn::make('was_fouled')->numeric(),
|
|
||||||
ImportColumn::make('offsides')->numeric(),
|
|
||||||
ImportColumn::make('date_acquisition')
|
|
||||||
->castStateUsing(function ($state) {
|
|
||||||
return Carbon::parse($state);
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
|
||||||
{
|
|
||||||
$body = 'Your events import has completed and '.Number::format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
|
||||||
$body .= ' '.Number::format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use MongoDB\Laravel\Eloquent\Model;
|
||||||
|
|
||||||
|
class StatistikoEvent extends Model
|
||||||
|
{
|
||||||
|
protected $connection = 'mongodb';
|
||||||
|
|
||||||
|
protected $table = 'events';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'sport_id',
|
||||||
|
'league_id',
|
||||||
|
'home_id',
|
||||||
|
'away_id',
|
||||||
|
'starttime',
|
||||||
|
'season',
|
||||||
|
'gls_h',
|
||||||
|
'gls_a',
|
||||||
|
'crn_h',
|
||||||
|
'fls_h',
|
||||||
|
'ofs_h',
|
||||||
|
'snt_h',
|
||||||
|
'tsh_h',
|
||||||
|
'crd_h',
|
||||||
|
'crn_a',
|
||||||
|
'fls_a',
|
||||||
|
'ofs_a',
|
||||||
|
'snt_a',
|
||||||
|
'tsh_a',
|
||||||
|
'crd_a',
|
||||||
|
'expgoalshome_value',
|
||||||
|
'expgoalsaway_value',
|
||||||
|
'exp_handicap',
|
||||||
|
'exp_total',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'starttime' => 'date',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function league(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(CompetitionGroup::class, 'league_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function home(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Element::class, 'home_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function away(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Element::class, 'away_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use MongoDB\Laravel\Eloquent\Model;
|
use MongoDB\Laravel\Eloquent\Model;
|
||||||
|
|
||||||
class UbPlayer extends Model
|
class StatistikoPlayer extends Model
|
||||||
{
|
{
|
||||||
protected $connection = 'mongodb';
|
protected $connection = 'mongodb';
|
||||||
|
|
||||||
@@ -33,21 +33,8 @@ class UbPlayer extends Model
|
|||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id_giocatore' => 'string',
|
|
||||||
'national_team_id' => 'string',
|
|
||||||
'altezza' => 'integer',
|
|
||||||
'sport_radar_id' => 'string',
|
|
||||||
'id_squadra_tm' => 'string',
|
|
||||||
'data_di_nascita' => 'date',
|
'data_di_nascita' => 'date',
|
||||||
'giocatore' => 'string',
|
'data_aggiornamento' => 'date',
|
||||||
'nazionalita' => 'string',
|
|
||||||
'posizione' => 'string',
|
|
||||||
'nome_completo' => 'string',
|
|
||||||
'rigorista' => 'string',
|
|
||||||
'data_aggiornamento' => 'string',
|
|
||||||
'league_code' => 'string',
|
|
||||||
'team_code' => 'string',
|
|
||||||
'team_name' => 'string',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use MongoDB\Laravel\Eloquent\Model;
|
|
||||||
|
|
||||||
class UbEvent extends Model
|
|
||||||
{
|
|
||||||
protected $connection = 'mongodb';
|
|
||||||
|
|
||||||
protected $table = 'events';
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'league_id',
|
|
||||||
'home_id',
|
|
||||||
'away_id',
|
|
||||||
'player_id',
|
|
||||||
'starttime',
|
|
||||||
'home_away',
|
|
||||||
'home_ft',
|
|
||||||
'away_ft',
|
|
||||||
'home_ht',
|
|
||||||
'away_ht',
|
|
||||||
'goals',
|
|
||||||
'assists',
|
|
||||||
'tackles',
|
|
||||||
'total_passes',
|
|
||||||
'passes_done',
|
|
||||||
'total_duels',
|
|
||||||
'duels_won',
|
|
||||||
'total_ground_duels',
|
|
||||||
'ground_duels_won',
|
|
||||||
'total_aerial_duels',
|
|
||||||
'aerial_duels_won',
|
|
||||||
'minutes_played',
|
|
||||||
'shots_on_target',
|
|
||||||
'shots_off_target',
|
|
||||||
'shots_blocked',
|
|
||||||
'total_dribble',
|
|
||||||
'dribble_done',
|
|
||||||
'position',
|
|
||||||
'rating',
|
|
||||||
'bcm',
|
|
||||||
'hw',
|
|
||||||
'pw',
|
|
||||||
'pm',
|
|
||||||
'possession_lost',
|
|
||||||
'fouls',
|
|
||||||
'was_fouled',
|
|
||||||
'offsides',
|
|
||||||
'date_acquisition',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected function casts(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'league_id' => 'integer',
|
|
||||||
'home_id' => 'integer',
|
|
||||||
'away_id' => 'integer',
|
|
||||||
'player_id' => 'integer',
|
|
||||||
'starttime' => 'date',
|
|
||||||
'date_acquisition' => 'date',
|
|
||||||
'rating' => 'string',
|
|
||||||
'home_away' => 'string',
|
|
||||||
'home_ft' => 'integer',
|
|
||||||
'away_ft' => 'integer',
|
|
||||||
'home_ht' => 'integer',
|
|
||||||
'away_ht' => 'integer',
|
|
||||||
'goals' => 'integer',
|
|
||||||
'assists' => 'integer',
|
|
||||||
'tackles' => 'integer',
|
|
||||||
'total_passes' => 'integer',
|
|
||||||
'passes_done' => 'integer',
|
|
||||||
'total_duels' => 'integer',
|
|
||||||
'duels_won' => 'integer',
|
|
||||||
'total_ground_duels' => 'integer',
|
|
||||||
'ground_duels_won' => 'integer',
|
|
||||||
'total_aerial_duels' => 'integer',
|
|
||||||
'aerial_duels_won' => 'integer',
|
|
||||||
'minutes_played' => 'integer',
|
|
||||||
'shots_on_target' => 'integer',
|
|
||||||
'shots_off_target' => 'integer',
|
|
||||||
'shots_blocked' => 'integer',
|
|
||||||
'total_dribble' => 'integer',
|
|
||||||
'dribble_done' => 'integer',
|
|
||||||
'position' => 'integer',
|
|
||||||
'bcm' => 'integer',
|
|
||||||
'hw' => 'integer',
|
|
||||||
'pw' => 'integer',
|
|
||||||
'pm' => 'integer',
|
|
||||||
'possession_lost' => 'integer',
|
|
||||||
'fouls' => 'integer',
|
|
||||||
'was_fouled' => 'integer',
|
|
||||||
'offsides' => 'integer',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function league(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(CompetitionGroup::class, 'league_id', 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function home(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Element::class, 'home_id', 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function away(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Element::class, 'away_id', 'id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
country_ss
|
|
||||||
league_ss
|
|
||||||
home
|
|
||||||
away
|
|
||||||
home_ft
|
|
||||||
away_ft
|
|
||||||
home_ht
|
|
||||||
away_ht
|
|
||||||
date_time_ss
|
|
||||||
team
|
|
||||||
player_ss
|
|
||||||
goals
|
|
||||||
assists
|
|
||||||
tackles
|
|
||||||
total_passes
|
|
||||||
passes_done
|
|
||||||
total_duels
|
|
||||||
duels_won
|
|
||||||
total_ground_duels
|
|
||||||
ground_duels_won
|
|
||||||
total_aerial_duels
|
|
||||||
aerial_duels_won
|
|
||||||
minutes_played
|
|
||||||
shots_on_target
|
|
||||||
shots_off_target
|
|
||||||
shots_blocked
|
|
||||||
total_dribble
|
|
||||||
dribble_done
|
|
||||||
position
|
|
||||||
rating
|
|
||||||
bcm
|
|
||||||
hw
|
|
||||||
pw
|
|
||||||
pm
|
|
||||||
possession_
|
|
||||||
lost
|
|
||||||
fouls
|
|
||||||
was_fouled
|
|
||||||
offsides
|
|
||||||
id_player_tm
|
|
||||||
h_a
|
|
||||||
date_player_id
|
|
||||||
date_home_away
|
|
||||||
id_league
|
|
||||||
data_di_acquisizione
|
|
||||||
txleague_id
|
|
||||||
txhome_id
|
|
||||||
txaway_id
|
|
||||||
Reference in new issue
Block a user