wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes;
|
||||
|
||||
use App\Models\StatisticFixtures;
|
||||
|
||||
class LoadEventsBoxes
|
||||
{
|
||||
public static function load(array $filter, bool $hasdots)
|
||||
{
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
$match_id = (int) $filter['match_id'] ?? 0;
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
$similar_past_matches = $filter['similar_past_matches'];
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $match_id) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first();
|
||||
|
||||
if (! $match) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$expectations = [];
|
||||
ExpectationsTeam::load($expectations, $filter, $match);
|
||||
|
||||
if ($team_id == $match->home_id) {
|
||||
$expectations['active_team'] = $match->home->ss_team_name;
|
||||
} else {
|
||||
$expectations['active_team'] = $match->away->ss_team_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* LEAGUE AVERAGES
|
||||
*/
|
||||
if ($team_id != 0 && $similar_past_matches == 'none') {
|
||||
AverageTeam::load($expectations, $filter);
|
||||
AverageTeamSeason::load($expectations, $filter);
|
||||
AverageLeagueSeason::load($expectations, $filter);
|
||||
}
|
||||
|
||||
return $expectations;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user