From 6eeef19fd90fb969fda0f5e1fb4be2cf0fb90f41 Mon Sep 17 00:00:00 2001 From: salam Date: Thu, 18 Jun 2026 15:32:47 +0200 Subject: [PATCH] wip --- app/Filament/Widgets/Data/LoadEvents.php | 41 ++++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/app/Filament/Widgets/Data/LoadEvents.php b/app/Filament/Widgets/Data/LoadEvents.php index a7cab168..52b7b911 100644 --- a/app/Filament/Widgets/Data/LoadEvents.php +++ b/app/Filament/Widgets/Data/LoadEvents.php @@ -101,23 +101,44 @@ class LoadEvents /** * IF WITH PLAYER */ - $matches_played = 0; + $matches_played = []; $description = ''; if ($tm_player_id) { - $matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id) - ->when($player_on_field, function ($query) use ($player_on_field) { + // $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'); + // case 'notplayed': + // return $query->where('minutes_played', 0); + // } + // }) + // ->pluck('match_id')->toArray(); + $res = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)->get(); + foreach ($res as $value) { switch ($player_on_field) { + case 'all': + $matches_played[] = $value->match_id; + break; case 'lineup': - return $query->where('lineup', 'T'); + if($value->lineup == 'T'){ + $matches_played[] = $value->match_id; + } + break; case 'substituted': - return $query->where('lineup', 'P'); + if($value->lineup == 'p'){ + $matches_played[] = $value->match_id; + } + break; case 'notplayed': - return $query->where('minutes_played', 0); + if(!$value->minutes_played){ + $matches_played[] = $value->match_id; + } + break; } - }) - ->pluck('match_id')->toArray(); - - // dd($matches_played); + } $description = ' with ' . StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name') . ' (' . \count($matches_played) . ')';