100 lines
4.2 KiB
PHP
100 lines
4.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Exports;
|
|
|
|
use App\Models\PlayerHistory;
|
|
use Filament\Actions\Exports\ExportColumn;
|
|
use Filament\Actions\Exports\Exporter;
|
|
use Filament\Actions\Exports\Models\Export;
|
|
use Illuminate\Support\Number;
|
|
|
|
class PlayerHistoryExporter extends Exporter
|
|
{
|
|
protected static ?string $model = PlayerHistory::class;
|
|
|
|
public static function getColumns(): array
|
|
{
|
|
return [
|
|
ExportColumn::make('match_id'),
|
|
ExportColumn::make('ss_player_id'),
|
|
ExportColumn::make('tm_player_id'),
|
|
ExportColumn::make('sport_id'),
|
|
ExportColumn::make('activeteam_id'),
|
|
ExportColumn::make('assists'),
|
|
ExportColumn::make('bcc'),
|
|
ExportColumn::make('bcm'),
|
|
ExportColumn::make('blocked_shots'),
|
|
ExportColumn::make('card_red'),
|
|
ExportColumn::make('card_yellow'),
|
|
ExportColumn::make('card_yellowred'),
|
|
ExportColumn::make('clearance_off_line'),
|
|
ExportColumn::make('clearances'),
|
|
ExportColumn::make('cross_done'),
|
|
ExportColumn::make('description_event_during_the_match'),
|
|
ExportColumn::make('dispossessed'),
|
|
ExportColumn::make('dribbled_past'),
|
|
ExportColumn::make('dribbles_won'),
|
|
ExportColumn::make('errors_lead_to_a_goal'),
|
|
ExportColumn::make('errors_lead_to_a_shot'),
|
|
ExportColumn::make('fouls'),
|
|
ExportColumn::make('goals'),
|
|
ExportColumn::make('good_high_claim'),
|
|
ExportColumn::make('hit_woodwork'),
|
|
ExportColumn::make('ingamepenalty_missed'),
|
|
ExportColumn::make('interceptions'),
|
|
ExportColumn::make('key_pass'),
|
|
ExportColumn::make('last_man_tackle'),
|
|
ExportColumn::make('lineup'),
|
|
ExportColumn::make('long_balls'),
|
|
ExportColumn::make('minute_event_during_the_match'),
|
|
ExportColumn::make('minutes_played'),
|
|
ExportColumn::make('offsides'),
|
|
ExportColumn::make('own_goals'),
|
|
ExportColumn::make('pass'),
|
|
ExportColumn::make('penalty_committed'),
|
|
ExportColumn::make('penalty_miss'),
|
|
ExportColumn::make('penalty_save'),
|
|
ExportColumn::make('penalty_won'),
|
|
ExportColumn::make('penaltyshoutout_missed'),
|
|
ExportColumn::make('penaltyshoutout_scored'),
|
|
ExportColumn::make('player_position'),
|
|
ExportColumn::make('playerrating_value'),
|
|
ExportColumn::make('playersubstitute_id'),
|
|
ExportColumn::make('possessions_lost'),
|
|
ExportColumn::make('punches'),
|
|
ExportColumn::make('runs_out'),
|
|
ExportColumn::make('saves'),
|
|
ExportColumn::make('saves_from_in_box'),
|
|
ExportColumn::make('shots_blocked'),
|
|
ExportColumn::make('shots_off_target'),
|
|
ExportColumn::make('shots_on_target'),
|
|
ExportColumn::make('subtype_event_during_the_match'),
|
|
ExportColumn::make('total_aerial_duels'),
|
|
ExportColumn::make('total_cross'),
|
|
ExportColumn::make('total_dribbles'),
|
|
ExportColumn::make('total_duels_aerial_won'),
|
|
ExportColumn::make('total_ground_duels'),
|
|
ExportColumn::make('total_ground_duels_won'),
|
|
ExportColumn::make('total_long_balls'),
|
|
ExportColumn::make('total_pass'),
|
|
ExportColumn::make('total_runs_out'),
|
|
ExportColumn::make('total_tackles'),
|
|
ExportColumn::make('touches'),
|
|
ExportColumn::make('type_event_during_the_match'),
|
|
ExportColumn::make('updated_at'),
|
|
ExportColumn::make('was_fouled'),
|
|
];
|
|
}
|
|
|
|
public static function getCompletedNotificationBody(Export $export): string
|
|
{
|
|
$body = 'Your player history export has completed and '.Number::format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
|
|
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
|
$body .= ' '.Number::format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
|
}
|
|
|
|
return $body;
|
|
}
|
|
}
|