Files
nuhodds_fi4/app/Filament/Widgets/Boxes/ExpectationsTeam.php
T
2026-10-12 21:51:50 +02:00

71 lines
2.9 KiB
PHP

<?php
namespace App\Filament\Widgets\Boxes;
use App\Filament\Widgets\Boxes\Helper\ExpectationCollecting;
use App\Filament\Widgets\Boxes\Helper\ExpectationMethodA;
use App\Filament\Widgets\Boxes\Helper\ExpectationMethodB;
use App\Filament\Widgets\Boxes\Helper\ExpectationsMinMax;
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
class ExpectationsTeam
{
public static $collectionMethod = 'B';
public static function load(array &$expectations, array $filter, object $match)
{
/**
* STATTISTIC DATA
*/
$similar_past_matches = $filter['similar_past_matches'];
$res = LoadEventsQueryAll::load($filter, $match);
if (! $res) {
return [];
}
$tmp = [];
foreach ($res as $value) {
// dd($match->home_id, $match->away_id, $value);
ExpectationCollecting::sort($similar_past_matches, $expectations, 'gls', $value->home_id, $value->away_id, $value->gls_h, $value->gls_a, $match);
ExpectationCollecting::sort($similar_past_matches, $expectations, 'fls', $value->home_id, $value->away_id, $value->fls_h, $value->fls_a, $match);
ExpectationCollecting::sort($similar_past_matches, $expectations, 'ofs', $value->home_id, $value->away_id, $value->ofs_h, $value->ofs_a, $match);
ExpectationCollecting::sort($similar_past_matches, $expectations, 'crd', $value->home_id, $value->away_id, $value->crd_h, $value->crd_a, $match);
ExpectationCollecting::sort($similar_past_matches, $expectations, 'snt', $value->home_id, $value->away_id, $value->snt_h, $value->snt_a, $match);
ExpectationCollecting::sort($similar_past_matches, $expectations, 'tsh', $value->home_id, $value->away_id, $value->tsh_h, $value->tsh_a, $match);
ExpectationCollecting::sort($similar_past_matches, $expectations, 'crn', $value->home_id, $value->away_id, $value->crn_h, $value->crn_a, $match);
}
if ($expectations) {
if (self::$collectionMethod == 'A' or $similar_past_matches != 'none') {
$expectations = ExpectationMethodA::calc($tmp);
} else {
$expectations = ExpectationMethodB::calc($tmp);
ExpectationsMinMax::calc($expectations, $match);
}
}
}
// public static function template()
// {
// $arr = [];
// $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh'];
// foreach ($bets as $bet) {
// foreach (['team_home', 'team_away'] as $team) {
// foreach (['scored', 'conceded'] as $sc) {
// foreach (['home', 'away'] as $ha) {
// foreach (['evt', 'sum'] as $es) {
// $arr[$bet][$team][$sc][$ha][$es] = 0;
// }
// }
// }
// }
// }
// return $arr;
// }
}