From ea1acb50a9252a473f227e7cdc0d0bb325416c66 Mon Sep 17 00:00:00 2001 From: salam Date: Mon, 24 Aug 2026 15:45:10 +0200 Subject: [PATCH] wip --- .../Widgets/Data/LoadEvents/LoadEventsQuery.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php b/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php index 006a43e7..d81564e9 100644 --- a/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php +++ b/app/Filament/Widgets/Data/LoadEvents/LoadEventsQuery.php @@ -94,10 +94,17 @@ class LoadEventsQuery return $query->where('league_id', $league_id); } }) - ->where(function ($query) use ($team_id, $similar_past_matches) { + ->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) { if ($similar_past_matches == 'none') { - return $query->where('home_id', '=', $team_id) - ->orWhere('away_id', '=', $team_id); + if ($team_id) { + return $query->where('home_id', '=', $team_id) + ->orWhere('away_id', '=', $team_id); + } else { + return $query->where('home_id', '=', $home_id) + ->orWhere('away_id', '=', $home_id) + ->orWhere('home_id', '=', $away_id) + ->orWhere('away_id', '=', $away_id); + } } }) ->when($matches_played, function ($query) use ($matches_played, $player_on_field) {