This commit is contained in:
salam committed 2026-08-29 19:13:07 +02:00
1 parent 82f3654a05
commit be4a08982e
8 files changed
+364 -326

No files matched your search

@@ -2,6 +2,7 @@
namespace App\Filament\Widgets\Data\LoadEvents;
use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\StatistikoEvent;
use App\Models\StatistikoPlayer;
@@ -12,14 +13,19 @@ class LoadEventsQuery
$league_id = (int) $filter['league_id'] ?? 0;
$team_id = (int) $filter['team_id'] ?? 0;
$season = $filter['season'] ?? 0;
$sofascore_category_id = $filter['sofascore_category_id'] ?? 0;
$season_or_date = $filter['season_or_date'];
$start = $filter['start_date'] ?? 0;
$end = $filter['end_date'] ?? 0;
if ($season_or_date == 'season') {
$start = 0;
$end = 0;
}
$ss_player_id = (int) $filter['ss_player_id'] ?? 0;
$player_on_field = $filter['player_on_field'] ?? 'all';
$similar_past_matches = $filter['similar_past_matches'];
$statistic_type = $filter['statistic_type'] ?? 'gls';
$team_position = $filter['team_position'];
$season_or_date = $filter['season_or_date'] ?? 'season';
$home_id = $match->home_id;
$away_id = $match->away_id;
@@ -27,15 +33,9 @@ class LoadEventsQuery
$statistic_type = 'gls';
}
switch ($season_or_date) {
case 'season':
$start = 0;
$end = 0;
break;
default:
$season = 0;
break;
}
$season = GetSeason::load($season, $sofascore_category_id);
// dd($season);
/**
* IF WITH PLAYER
@@ -107,13 +107,13 @@ class LoadEventsQuery
}
}
})
->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
if ($player_on_field == 'notplayed') {
return $query->whereNotIn('match_id', $matches_played);
} else {
return $query->whereIn('match_id', $matches_played);
}
})
// ->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
// if ($player_on_field == 'notplayed') {
// return $query->whereNotIn('match_id', $matches_played);
// } else {
// return $query->whereIn('match_id', $matches_played);
// }
// })
->when($handicap_range, function ($query) use ($handicap_range) {
return $query->whereBetween('exp_handicap', $handicap_range);
})->when($total_range, function ($query) use ($total_range) {
@@ -122,12 +122,15 @@ class LoadEventsQuery
return $query->whereDate('starttime', '>=', $start);
})->when($end, function ($query) use ($end) {
return $query->whereDate('starttime', '<=', $end);
})->when($season, function ($query) use ($season) {
return $query->whereIn('season', $season);
})->when($season, function ($query) use ($season, $season_or_date) {
if ($season_or_date == 'season')
return $query->whereIn('season', $season);
})
->orderBy('starttime', 'ASC')
->get();
// dd($res);
$arr = [];
foreach ($res as $value) {