modifications details
This commit is contained in:
1 parent
c143dcf727
commit
c1892e86aa
21 files changed
+99
-108
No files matched your search
@@ -11,13 +11,13 @@ class LoadPlayer
|
|||||||
public static function load(Get $get)
|
public static function load(Get $get)
|
||||||
{
|
{
|
||||||
$team_id = $get('team_id');
|
$team_id = $get('team_id');
|
||||||
|
|
||||||
$season = $get('season');
|
$season = $get('season');
|
||||||
|
|
||||||
$team_position = $get('team_position');
|
$team_position = $get('team_position');
|
||||||
|
|
||||||
$season_or_date = $filter['season_or_date'] ?? 'season';
|
$season_or_date = $filter['season_or_date'] ?? 'season';
|
||||||
if($season_or_date != 'season' or !count($season)) {
|
if ($season_or_date != 'season' or !count($season)) {
|
||||||
$season[] = date('Y');
|
$season[] = date('Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,20 +52,17 @@ class LoadPlayer
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colorlevel = round($matches_count/3);
|
$colorlevel = round($matches_count / 3);
|
||||||
|
|
||||||
$position = strtoupper($val->details->position);
|
$position = strtoupper($val->details->position);
|
||||||
|
|
||||||
if($events_played < $colorlevel){
|
if ($events_played < $colorlevel) {
|
||||||
$arr[$position][$val->tm_player_id] = '<span class="text-red-600 dark:text-red-500">'.$val->details->name.' ('.$events_played.')</span>';
|
$arr[$position][$val->ss_player_id] = '<span class="text-red-600 dark:text-red-500">' . $val->details->name . ' (' . $events_played . ')</span>';
|
||||||
|
} else if ($events_played < $colorlevel * 2) {
|
||||||
|
$arr[$position][$val->ss_player_id] = '<span class="text-blue-600 dark:text-blue-500">' . $val->details->name . ' (' . $events_played . ')</span>';
|
||||||
|
} else {
|
||||||
|
$arr[$position][$val->ss_player_id] = '<span class="text-green-600 dark:text-green-500">' . $val->details->name . ' (' . $events_played . ')</span>';
|
||||||
}
|
}
|
||||||
else if($events_played < $colorlevel*2){
|
|
||||||
$arr[$position][$val->tm_player_id] = '<span class="text-blue-600 dark:text-blue-500">'.$val->details->name.' ('.$events_played.')</span>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$arr[$position][$val->tm_player_id] = '<span class="text-green-600 dark:text-green-500">'.$val->details->name.' ('.$events_played.')</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class PlayerPerSeason
|
|||||||
{
|
{
|
||||||
$debug = Nuh::$options['d'] ?? 0;
|
$debug = Nuh::$options['d'] ?? 0;
|
||||||
|
|
||||||
$res = StatistikoDetail::query()->select('tm_player_id', 'txodds_id')->get();
|
$res = StatistikoDetail::query()->select('ss_player_id', 'txodds_id')->get();
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
Notice::note('process ' . $res->count() . " player", 'bb');
|
Notice::note('process ' . $res->count() . " player", 'bb');
|
||||||
@@ -24,7 +24,7 @@ class PlayerPerSeason
|
|||||||
|
|
||||||
$collection = [];
|
$collection = [];
|
||||||
|
|
||||||
$res2 = StatistikoPlayer::with('event')->where('tm_player_id', $val->tm_player_id)->get();
|
$res2 = StatistikoPlayer::with('event')->where('ss_player_id', $val->ss_player_id)->get();
|
||||||
|
|
||||||
foreach ($res2 as $val2) {
|
foreach ($res2 as $val2) {
|
||||||
|
|
||||||
@@ -46,10 +46,10 @@ class PlayerPerSeason
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($collection as $season => $row) {
|
foreach ($collection as $season => $row) {
|
||||||
if ($val->txodds_id && $val->tm_player_id) {
|
if ($val->txodds_id && $val->ss_player_id) {
|
||||||
SofaScorePlayerPerSeason::updateOrCreate(
|
SofaScorePlayerPerSeason::updateOrCreate(
|
||||||
[
|
[
|
||||||
'tm_player_id' => $val->tm_player_id,
|
'ss_player_id' => $val->ss_player_id,
|
||||||
'tx_team_id' => $val->txodds_id,
|
'tx_team_id' => $val->txodds_id,
|
||||||
'season' => $season
|
'season' => $season
|
||||||
],
|
],
|
||||||
|
|||||||
+6
-10
@@ -17,21 +17,17 @@ class StatistikoDetailForm
|
|||||||
'default' => 2,
|
'default' => 2,
|
||||||
'xl' => 4,
|
'xl' => 4,
|
||||||
])->schema([
|
])->schema([
|
||||||
TextInput::make('tm_player_id')->required(),
|
TextInput::make('ss_player_id')->required(),
|
||||||
TextInput::make('name')->required(),
|
TextInput::make('player_name')->required(),
|
||||||
TextInput::make('full_name'),
|
|
||||||
DatePicker::make('birthdate'),
|
DatePicker::make('birthdate'),
|
||||||
TextInput::make('height'),
|
TextInput::make('height'),
|
||||||
TextInput::make('nationality'),
|
TextInput::make('nationality'),
|
||||||
TextInput::make('position'),
|
TextInput::make('position'),
|
||||||
TextInput::make('sport_radar_id'),
|
TextInput::make('ss_national_team_id'),
|
||||||
TextInput::make('id_squadra_tm'),
|
TextInput::make('tx_team_id'),
|
||||||
TextInput::make('rigorist'),
|
|
||||||
TextInput::make('national_team_id'),
|
|
||||||
DatePicker::make('last_update'),
|
|
||||||
TextInput::make('league_code'),
|
|
||||||
TextInput::make('team_code'),
|
|
||||||
TextInput::make('team_name'),
|
TextInput::make('team_name'),
|
||||||
|
TextInput::make('preferred_foot'),
|
||||||
|
DatePicker::make('last_update'),
|
||||||
]),
|
]),
|
||||||
])->columns(1);
|
])->columns(1);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ class StatistikoDetailResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 4;
|
protected static ?int $navigationSort = 4;
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-12
@@ -24,23 +24,19 @@ class StatistikoDetailsTable
|
|||||||
->paginationPageOptions([8, 16, 24, 36])
|
->paginationPageOptions([8, 16, 24, 36])
|
||||||
->columns([
|
->columns([
|
||||||
Stack::make([
|
Stack::make([
|
||||||
TextColumn::make('tm_player_id')->prefix('Id: ')->searchable()->color('success')->icon('phosphor-copy')->copyable(),
|
TextColumn::make('ss_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('player_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('birthdate')->date()->prefix('Birthdate: '),
|
||||||
TextColumn::make('height')->prefix('Height: ')->suffix(' cm'),
|
TextColumn::make('height')->prefix('Height: ')->suffix(' cm'),
|
||||||
TextColumn::make('nationality')->prefix('Nationality: '),
|
TextColumn::make('nationality')->prefix('Nationality: '),
|
||||||
TextColumn::make('position')->prefix('Position: '),
|
TextColumn::make('position')->prefix('Position: '),
|
||||||
TextColumn::make('sport_radar_id')->searchable()->prefix('Sport Radar Id: ')->icon('phosphor-copy')->copyable(),
|
TextColumn::make('ss_national_team_id')->prefix('National Team Id: '),
|
||||||
TextColumn::make('id_squadra_tm')->prefix('Team Id TM: '),
|
TextColumn::make('tx_team_id')->prefix('Team Id: '),
|
||||||
TextColumn::make('rigorist')->prefix('Rigorist: '),
|
TextColumn::make('team_name')->prefix('Team Name: '),
|
||||||
TextColumn::make('national_team_id')->prefix('National Team Id: '),
|
TextColumn::make('preferred_foot')->prefix('Preferred Foot: '),
|
||||||
TextColumn::make('last_update')->date()->prefix('Last Update: '),
|
TextColumn::make('last_update')->date()->prefix('Last Update: '),
|
||||||
TextColumn::make('created_at')->date()->prefix('Created: '),
|
TextColumn::make('created_at')->date()->prefix('Created: '),
|
||||||
TextColumn::make('updated_at')->date()->prefix('Updated: '),
|
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: '),
|
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->emptyStateHeading('No double player in details')
|
->emptyStateHeading('No double player in details')
|
||||||
@@ -56,12 +52,12 @@ class StatistikoDetailsTable
|
|||||||
return $query->when(
|
return $query->when(
|
||||||
$data['find_double'],
|
$data['find_double'],
|
||||||
function (Builder $query) {
|
function (Builder $query) {
|
||||||
$pDetails = StatistikoDetail::pluck('tm_player_id')->toArray();
|
$pDetails = StatistikoDetail::pluck('ss_player_id')->toArray();
|
||||||
$doublpDetails = array_diff_assoc(
|
$doublpDetails = array_diff_assoc(
|
||||||
$pDetails,
|
$pDetails,
|
||||||
array_unique($pDetails)
|
array_unique($pDetails)
|
||||||
);
|
);
|
||||||
$query->whereIn('tm_player_id', $doublpDetails)->orderBy('tm_player_id');
|
$query->whereIn('ss_player_id', $doublpDetails)->orderBy('ss_player_id');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
})->indicateUsing(function (array $data): ?string {
|
})->indicateUsing(function (array $data): ?string {
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ class StatistikoPlayerForm
|
|||||||
TextInput::make('sport_id'),
|
TextInput::make('sport_id'),
|
||||||
TextInput::make('match_id'),
|
TextInput::make('match_id'),
|
||||||
TextInput::make('ss_player_id'),
|
TextInput::make('ss_player_id'),
|
||||||
TextInput::make('tm_player_id'),
|
TextInput::make('ss_player_id'),
|
||||||
TextInput::make('activeteam_id'),
|
TextInput::make('activeteam_id'),
|
||||||
TextInput::make('playersubstitute_id'),
|
TextInput::make('playersubstitute_id'),
|
||||||
TextInput::make('goals'),
|
TextInput::make('goals'),
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ class StatistikoPlayersTable
|
|||||||
->label('Player')
|
->label('Player')
|
||||||
->searchable()
|
->searchable()
|
||||||
->tooltip(fn($record) => $record->details->full_name),
|
->tooltip(fn($record) => $record->details->full_name),
|
||||||
TextColumn::make('tm_player_id')->label('TM Id')->searchable(),
|
TextColumn::make('ss_player_id')->label('TM Id')->searchable(),
|
||||||
TextColumn::make('ss_player_id')->label('SS Id')->searchable(),
|
TextColumn::make('ss_player_id')->label('SS Id')->searchable(),
|
||||||
TextColumn::make('event.home.name')->searchable()->color('primary'),
|
TextColumn::make('event.home.name')->searchable()->color('primary'),
|
||||||
TextColumn::make('event.away.name')->searchable()->color('success'),
|
TextColumn::make('event.away.name')->searchable()->color('success'),
|
||||||
|
|||||||
@@ -24,26 +24,35 @@ class ImportDetails
|
|||||||
|
|
||||||
if ($row[1] != '') {
|
if ($row[1] != '') {
|
||||||
|
|
||||||
|
// 'ss_player_id',
|
||||||
|
// 'player_name',
|
||||||
|
// 'tx_team_id',
|
||||||
|
// 'ss_national_team_id',
|
||||||
|
// 'team_name',
|
||||||
|
// 'birthday',
|
||||||
|
// 'height',
|
||||||
|
// 'nationality',
|
||||||
|
// 'position',
|
||||||
|
// 'preferred_foot',
|
||||||
|
// 'last_update',
|
||||||
|
// 'created_at',
|
||||||
|
// 'updated_at',
|
||||||
|
|
||||||
StatistikoDetail::updateOrCreate(
|
StatistikoDetail::updateOrCreate(
|
||||||
[
|
[
|
||||||
'tm_player_id' => (int) $row[0],
|
'ss_player_id' => (int) $row[0],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => $row[1],
|
'player_name' => $row[1],
|
||||||
'birthdate' => Carbon::parse($row[2])->toDateString(),
|
'tx_team_id' => $row[2],
|
||||||
'height' => $row[3],
|
'ss_national_team_id' => $row[3],
|
||||||
'nationality' => $row[4],
|
'team_name' => $row[4],
|
||||||
'position' => $row[5],
|
'birthdate' => Carbon::parse($row[5])->toDateString(),
|
||||||
'sport_radar_id' => $row[6],
|
'height' => $row[6],
|
||||||
'id_squadra_tm' => $row[7],
|
'nationality' => $row[7],
|
||||||
'full_name' => $row[8],
|
'position' => $row[8],
|
||||||
'no_specialities' => $row[9],
|
'preferred_foot' => $row[9],
|
||||||
'txodds_id' => $row[10],
|
'last_update' => Carbon::parse($row[10])->toDateString(),
|
||||||
'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,
|
'created_at' => $now,
|
||||||
'updated_at' => $now,
|
'updated_at' => $now,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class ImportPlayer
|
|||||||
'penaltyshoutout_missed',
|
'penaltyshoutout_missed',
|
||||||
'player_position',
|
'player_position',
|
||||||
'playerrating_value',
|
'playerrating_value',
|
||||||
'tm_player_id'
|
'ss_player_id'
|
||||||
];
|
];
|
||||||
|
|
||||||
SimpleExcelReader::create(storage_path('app/public/' . $filePath))
|
SimpleExcelReader::create(storage_path('app/public/' . $filePath))
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class Statistic extends BaseDashboard
|
|||||||
->afterStateUpdated(function (callable $set, $state) {
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
$set('match_id', null);
|
$set('match_id', null);
|
||||||
$set('team_id', null);
|
$set('team_id', null);
|
||||||
$set('tm_player_id', null);
|
$set('ss_player_id', null);
|
||||||
$set('season', null);
|
$set('season', null);
|
||||||
}),
|
}),
|
||||||
Select::make('match_id')
|
Select::make('match_id')
|
||||||
@@ -86,7 +86,7 @@ class Statistic extends BaseDashboard
|
|||||||
})
|
})
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('team_id', null);
|
$set('team_id', null);
|
||||||
$set('tm_player_id', null);
|
$set('ss_player_id', null);
|
||||||
})
|
})
|
||||||
->placeholder('Events'),
|
->placeholder('Events'),
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ class Statistic extends BaseDashboard
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('tm_player_id', null);
|
$set('ss_player_id', null);
|
||||||
})
|
})
|
||||||
->placeholder('Team'),
|
->placeholder('Team'),
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ class Statistic extends BaseDashboard
|
|||||||
'away' => 'Away',
|
'away' => 'Away',
|
||||||
])->afterStateUpdated(function (callable $set) {
|
])->afterStateUpdated(function (callable $set) {
|
||||||
// $set('team_id', null);
|
// $set('team_id', null);
|
||||||
$set('tm_player_id', null);
|
$set('ss_player_id', null);
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
Grid::make([
|
Grid::make([
|
||||||
@@ -196,7 +196,7 @@ class Statistic extends BaseDashboard
|
|||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('team_id', null);
|
$set('team_id', null);
|
||||||
$set('tm_player_id', null);
|
$set('ss_player_id', null);
|
||||||
$set('team_position', null);
|
$set('team_position', null);
|
||||||
})
|
})
|
||||||
->options([
|
->options([
|
||||||
@@ -218,7 +218,7 @@ class Statistic extends BaseDashboard
|
|||||||
->pipsFormatter(RawJs::make(<<<'JS'
|
->pipsFormatter(RawJs::make(<<<'JS'
|
||||||
`${$value.toFixed(2)}`
|
`${$value.toFixed(2)}`
|
||||||
JS)),
|
JS)),
|
||||||
Select::make('tm_player_id')
|
Select::make('ss_player_id')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->allowHtml()
|
->allowHtml()
|
||||||
@@ -237,12 +237,12 @@ class Statistic extends BaseDashboard
|
|||||||
->placeholder('Time on field')
|
->placeholder('Time on field')
|
||||||
->prefixIcon('phosphor-watch-fill')
|
->prefixIcon('phosphor-watch-fill')
|
||||||
->default('all')
|
->default('all')
|
||||||
->hidden(fn(Get $get) => ! $get('tm_player_id'))
|
->hidden(fn(Get $get) => ! $get('ss_player_id'))
|
||||||
->prefixIconColor('success')
|
->prefixIconColor('success')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
// ->afterStateUpdated(function (callable $set) {
|
// ->afterStateUpdated(function (callable $set) {
|
||||||
// // $set('team_id', null);
|
// // $set('team_id', null);
|
||||||
// $set('tm_player_id', null);
|
// $set('ss_player_id', null);
|
||||||
// })
|
// })
|
||||||
->options([
|
->options([
|
||||||
'all' => 'All',
|
'all' => 'All',
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class LoadEvents
|
|||||||
|
|
||||||
$season = $filter['season'] ?? 0;
|
$season = $filter['season'] ?? 0;
|
||||||
|
|
||||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
$ss_player_id = (int) $filter['ss_player_id'] ?? 0;
|
||||||
|
|
||||||
$start = $filter['start_date'] ?? 0;
|
$start = $filter['start_date'] ?? 0;
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ class LoadEvents
|
|||||||
$matches_played = [];
|
$matches_played = [];
|
||||||
$description = '';
|
$description = '';
|
||||||
|
|
||||||
if ($tm_player_id) {
|
if ($ss_player_id) {
|
||||||
|
|
||||||
$matches_season = StatistikoEvent::where(function ($query) use ($team_id, $team_position) {
|
$matches_season = StatistikoEvent::where(function ($query) use ($team_id, $team_position) {
|
||||||
switch ($team_position) {
|
switch ($team_position) {
|
||||||
@@ -113,7 +113,7 @@ class LoadEvents
|
|||||||
|
|
||||||
$matches_played = StatistikoPlayer::query()
|
$matches_played = StatistikoPlayer::query()
|
||||||
->whereIn('match_id', $matches_season)
|
->whereIn('match_id', $matches_season)
|
||||||
->where('tm_player_id', $tm_player_id)
|
->where('ss_player_id', $ss_player_id)
|
||||||
->when($player_on_field, function ($query) use ($player_on_field) {
|
->when($player_on_field, function ($query) use ($player_on_field) {
|
||||||
// 'all' => 'All',
|
// 'all' => 'All',
|
||||||
// 'lineup' => 'Lineup',
|
// 'lineup' => 'Lineup',
|
||||||
@@ -132,7 +132,7 @@ class LoadEvents
|
|||||||
})
|
})
|
||||||
->pluck('match_id')->toArray();
|
->pluck('match_id')->toArray();
|
||||||
|
|
||||||
$description = ' with ' . StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name') . ' (' . \count($matches_played) . ')';
|
$description = ' with ' . StatistikoDetail::where('ss_player_id', (int) $ss_player_id)->value('name') . ' (' . \count($matches_played) . ')';
|
||||||
|
|
||||||
if (! $matches_played) {
|
if (! $matches_played) {
|
||||||
$matches_played[] = -1;
|
$matches_played[] = -1;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class LoadPlayer
|
|||||||
|
|
||||||
$team_id = (int) $filter['team_id'] ?? 0;
|
$team_id = (int) $filter['team_id'] ?? 0;
|
||||||
|
|
||||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
$ss_player_id = (int) $filter['ss_player_id'] ?? 0;
|
||||||
|
|
||||||
$start = $filter['start_date'] ?? 0;
|
$start = $filter['start_date'] ?? 0;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class LoadPlayer
|
|||||||
if (! $team_id) {
|
if (! $team_id) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (! $tm_player_id) {
|
if (! $ss_player_id) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,9 +46,9 @@ class LoadPlayer
|
|||||||
$statistic_type = 'gls';
|
$statistic_type = 'gls';
|
||||||
}
|
}
|
||||||
|
|
||||||
$player_name = StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name');
|
$player_name = StatistikoDetail::where('ss_player_id', (int) $ss_player_id)->value('name');
|
||||||
|
|
||||||
$res = StatistikoPlayer::with('event')->where('tm_player_id', (int) $tm_player_id)->get();
|
$res = StatistikoPlayer::with('event')->where('ss_player_id', (int) $ss_player_id)->get();
|
||||||
|
|
||||||
$labels = [];
|
$labels = [];
|
||||||
$datasets = [];
|
$datasets = [];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class LoadPlayerPerformance
|
|||||||
|
|
||||||
$team_id = (int) $filter['team_id'] ?? 0;
|
$team_id = (int) $filter['team_id'] ?? 0;
|
||||||
|
|
||||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
$ss_player_id = (int) $filter['ss_player_id'] ?? 0;
|
||||||
|
|
||||||
$statistic_type = $filter['statistic_type'] ?? 'gls';
|
$statistic_type = $filter['statistic_type'] ?? 'gls';
|
||||||
|
|
||||||
@@ -32,18 +32,18 @@ class LoadPlayerPerformance
|
|||||||
if (! $team_id) {
|
if (! $team_id) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (! $tm_player_id) {
|
if (! $ss_player_id) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$player_name = StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name');
|
$player_name = StatistikoDetail::where('ss_player_id', (int) $ss_player_id)->value('name');
|
||||||
|
|
||||||
if ($statistic_type == 'none') {
|
if ($statistic_type == 'none') {
|
||||||
$statistic_type = 'gls';
|
$statistic_type = 'gls';
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches_played = StatistikoPlayer::with('event')
|
$matches_played = StatistikoPlayer::with('event')
|
||||||
->where('tm_player_id', (int) $tm_player_id)
|
->where('ss_player_id', (int) $ss_player_id)
|
||||||
->when($player_on_field, function ($query) use ($player_on_field) {
|
->when($player_on_field, function ($query) use ($player_on_field) {
|
||||||
switch ($player_on_field) {
|
switch ($player_on_field) {
|
||||||
case 'lineup':
|
case 'lineup':
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class SofaScorePlayerPerSeason extends Model
|
class SofaScorePlayerPerSeason extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tm_player_id',
|
'ss_player_id',
|
||||||
'tx_team_id',
|
'tx_team_id',
|
||||||
'season',
|
'season',
|
||||||
'events_played_home',
|
'events_played_home',
|
||||||
@@ -18,6 +18,6 @@ class SofaScorePlayerPerSeason extends Model
|
|||||||
|
|
||||||
public function details()
|
public function details()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(StatistikoDetail::class, 'tm_player_id', 'tm_player_id');
|
return $this->belongsTo(StatistikoDetail::class, 'ss_player_id', 'ss_player_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,21 +13,17 @@ class StatistikoDetail extends Model
|
|||||||
protected $table = 'details';
|
protected $table = 'details';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'tm_player_id',
|
'ss_player_id',
|
||||||
'name',
|
'player_name',
|
||||||
'full_name',
|
'tx_team_id',
|
||||||
'birthdate',
|
'ss_national_team_id',
|
||||||
|
'team_name',
|
||||||
|
'birthday',
|
||||||
'height',
|
'height',
|
||||||
'nationality',
|
'nationality',
|
||||||
'position',
|
'position',
|
||||||
'sport_radar_id',
|
'preferred_foot',
|
||||||
'id_squadra_tm',
|
|
||||||
'rigorist',
|
|
||||||
'national_team_id',
|
|
||||||
'last_update',
|
'last_update',
|
||||||
'league_code',
|
|
||||||
'team_code',
|
|
||||||
'team_name',
|
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
];
|
];
|
||||||
@@ -42,6 +38,6 @@ class StatistikoDetail extends Model
|
|||||||
|
|
||||||
public function season()
|
public function season()
|
||||||
{
|
{
|
||||||
return $this->hasMany(SofaScorePlayerPerSeason::class, 'tm_player_id', 'tm_player_id');
|
return $this->hasMany(SofaScorePlayerPerSeason::class, 'ss_player_id', 'ss_player_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,6 @@ class StatistikoPlayer extends Model
|
|||||||
'sport_id',
|
'sport_id',
|
||||||
'match_id',
|
'match_id',
|
||||||
'ss_player_id',
|
'ss_player_id',
|
||||||
'tm_player_id',
|
|
||||||
'activeteam_id',
|
'activeteam_id',
|
||||||
'playersubstitute_id',
|
'playersubstitute_id',
|
||||||
'goals',
|
'goals',
|
||||||
@@ -72,7 +71,6 @@ class StatistikoPlayer extends Model
|
|||||||
'subtype_event_during_the_match',
|
'subtype_event_during_the_match',
|
||||||
'player_position',
|
'player_position',
|
||||||
'playerrating_value',
|
'playerrating_value',
|
||||||
'tm_player_id',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function event()
|
public function event()
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ return new class extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('details', function (Blueprint $collection) {
|
Schema::create('details', function (Blueprint $collection) {
|
||||||
$collection->unique('tm_player_id');
|
$collection->unique('ss_player_id');
|
||||||
$collection->index('name');
|
$collection->index('player_name');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ return new class extends Migration
|
|||||||
Schema::create('players', function (Blueprint $collection) {
|
Schema::create('players', function (Blueprint $collection) {
|
||||||
$collection->index('match_id');
|
$collection->index('match_id');
|
||||||
$collection->index('ss_player_id');
|
$collection->index('ss_player_id');
|
||||||
$collection->index('tm_player_id');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('sofa_score_player_per_seasons', function (Blueprint $table) {
|
Schema::create('sofa_score_player_per_seasons', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->integer('tm_player_id')->index();
|
$table->integer('ss_player_id')->index();
|
||||||
$table->integer('tx_team_id')->index();
|
$table->integer('tx_team_id')->index();
|
||||||
$table->string('season')->index();
|
$table->string('season')->index();
|
||||||
$table->integer('events_played_home')->default(0)->nullable();
|
$table->integer('events_played_home')->default(0)->nullable();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
@php
|
@php
|
||||||
$player_name = App\Models\StatistikoDetail::where('tm_player_id', (int) $this->filters['tm_player_id'])->value('name');
|
$player_name = App\Models\StatistikoDetail::where('ss_player_id', (int) $this->filters['ss_player_id'])->value('name');
|
||||||
@endphp
|
@endphp
|
||||||
<x-filament-panels::page>
|
<x-filament-panels::page>
|
||||||
|
|
||||||
{{ $this->filtersForm }}
|
{{ $this->filtersForm }}
|
||||||
|
|
||||||
@livewire(\App\Filament\Widgets\StatsMedianAverage::class, ['filters' => $this->filters])
|
@livewire(\App\Filament\Widgets\StatsMedianAverage::class, ['filters' => $this->filters])
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
</x-filament::tabs.item>
|
</x-filament::tabs.item>
|
||||||
|
|
||||||
@if($player_name)
|
@if($player_name)
|
||||||
<x-filament::tabs.item x-on:click="activeTab = 'tab3'" :alpine-active="'activeTab === \'' . 'tab3' . '\''" icon="icon-player">
|
<x-filament::tabs.item x-on:click="activeTab = 'tab3'" :alpine-active="'activeTab === \'' . 'tab3' . '\''" icon="icon-player">
|
||||||
{{ $player_name }}
|
{{ $player_name }}
|
||||||
</x-filament::tabs.item>
|
</x-filament::tabs.item>
|
||||||
|
|
||||||
<x-filament::tabs.item x-on:click="activeTab = 'tab4'" :alpine-active="'activeTab === \'' . 'tab4' . '\''" icon="icon-player">
|
<x-filament::tabs.item x-on:click="activeTab = 'tab4'" :alpine-active="'activeTab === \'' . 'tab4' . '\''" icon="icon-player">
|
||||||
{{ $player_name }} Performance
|
{{ $player_name }} Performance
|
||||||
</x-filament::tabs.item>
|
</x-filament::tabs.item>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</x-filament::tabs>
|
</x-filament::tabs>
|
||||||
@@ -55,4 +55,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</x-filament-panels::page>
|
</x-filament-panels::page>
|
||||||
@@ -57,4 +57,4 @@
|
|||||||
// subtype_event_during_the_match
|
// subtype_event_during_the_match
|
||||||
// player_position
|
// player_position
|
||||||
// playerrating_value
|
// playerrating_value
|
||||||
// tm_player_id
|
// ss_player_id
|
||||||
Reference in new issue
Block a user