wip
This commit is contained in:
1 parent
789a6e699a
commit
27badf9140
3 files changed
+19
-3
No files matched your search
@@ -33,6 +33,8 @@ class LoadEvents
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
$player_on_field = $filter['player_on_field'];
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
@@ -49,7 +51,20 @@ class LoadEvents
|
||||
$matches_played = 0;
|
||||
$description = '';
|
||||
if ($tm_player_id) {
|
||||
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)->pluck('match_id')->toArray();
|
||||
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)
|
||||
->when($player_on_field, function ($query) use ($player_on_field) {
|
||||
switch ($player_on_field) {
|
||||
case 'lineup':
|
||||
return $query->where('lineup', 'T');
|
||||
case 'substituted':
|
||||
return $query->where('lineup', 'P');
|
||||
}
|
||||
})
|
||||
->pluck('match_id')->toArray();
|
||||
|
||||
if (! $matches_played) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$description = ' (with '.StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name').')';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user