This commit is contained in:
salam committed 2026-08-01 11:58:50 +02:00
1 parent df0a2a9de0
commit a381a3c8c8
2 files changed
+8 -6

No files matched your search

@@ -3,13 +3,14 @@
namespace App\Filament\Widgets\Data\LoadEvents;
use App\Models\CompetitionGroup;
use App\Models\SofaScoreTournament;
use App\Models\StatistikoEvent;
class LoadEventsAverages
{
public static function load(array &$data, array $filter, array $labels, array $events)
{
$league_id = (int) $filter['league_id'] ?? 0;
$tournament_id = (int) $filter['league_id'] ?? 0;
$team_position = $filter['team_position'];
@@ -18,15 +19,16 @@ class LoadEventsAverages
$statistic_type = $filter['statistic_type'] ?? 'gls';
$res = CompetitionGroup::with('country')->where('id', $league_id)->first();
$season_mode = $res->country->season_mode;
$res = SofaScoreTournament::with('sofascore_category')->where('tournament_id', $tournament_id)->first();
$season_mode = $res->sofascore_category->country->season_mode;
if ($season_mode == 'fullyear') {
$season = date('Y');
} else {
$season = date('y') - 1 . '/' . date('Y');
}
$res = StatistikoEvent::where('league_id', $league_id)
$res = StatistikoEvent::where('league_id', $tournament_id)
->where('season', $season)
->orderBy('starttime', 'ASC')
->get();