wip date season in avverage
This commit is contained in:
1 parent
800917cad0
commit
f90887009c
4 files changed
+41
-37
No files matched your search
@@ -11,22 +11,27 @@ class LoadEventsAverages
|
||||
public static function load(array &$data, array $filter, array $labels, array $events)
|
||||
{
|
||||
$tournament_id = (int) $filter['league_id'] ?? 0;
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
$statistic_type = $filter['statistic_type'] ?? 'gls';
|
||||
|
||||
$season = $filter['season'] ?? 0;
|
||||
|
||||
$season_or_date = $filter['season_or_date'] ?? 'season';
|
||||
$start = $filter['start_date'] ?? 0;
|
||||
$end = $filter['end_date'] ?? 0;
|
||||
|
||||
if ($season_or_date != 'season')
|
||||
$season = 0;
|
||||
else {
|
||||
$end = 0;
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
$res = StatistikoEvent::where('league_id', $tournament_id)
|
||||
->when($season, function ($query) use ($season) {
|
||||
->when($start, function ($query) use ($start) {
|
||||
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);
|
||||
})
|
||||
->orderBy('starttime', 'ASC')
|
||||
|
||||
Reference in new issue
Block a user