This commit is contained in:
salam committed 2026-10-07 17:07:37 +02:00
1 parent 4b39c59630
commit 15e3fc392d
2 files changed
+11 -2

No files matched your search

@@ -30,6 +30,7 @@ class ExpectationsTeam
}
$res = LoadEventsQueryAll::load($filter, $match);
// dd($res);
$res_tp = LoadEventsQueryTP::load($filter, $match);
@@ -54,6 +55,7 @@ class ExpectationsTeam
ExpectationCollecting::sort($similar_past_matches, $tmp, 'crn', $value->home_id, $value->away_id, $value->crn_h, $value->crn_a, $match);
}
$expectations = ExpectationCalculation::calc($tmp);
$expectations['gls']['name'] = 'Goals';
$expectations['fls']['name'] = 'Fouls';
@@ -5,6 +5,7 @@ namespace App\Filament\Widgets\Charts\LoadEvents;
use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\StatistikoEvent;
use App\Models\StatistikoPlayer;
use Illuminate\Support\Facades\Log;
class LoadEventsQueryAll
{
@@ -82,7 +83,7 @@ class LoadEventsQueryAll
/**
* STATTISTIC DATA
*/
// Log::debug('result', [$similar_past_matches, $home_id, $away_id, $team_id]);
Log::debug('result', [$similar_past_matches, $team_id]);
return StatistikoEvent::with('home')->with('away')
->where(function ($query) use ($league_id, $similar_past_matches) {
@@ -92,10 +93,16 @@ class LoadEventsQueryAll
return $query->where('league_id', $league_id);
}
})
->when($team_id, function ($query) use ($team_id, $player_on_field) {
->where(function ($query) use ($team_id, $similar_past_matches) {
if ($team_id && $similar_past_matches == 'none') {
return $query->where('home_id', '=', $team_id)
->orWhere('away_id', '=', $team_id);
}
})
// ->when($team_id, function ($query) use ($team_id) {
// return $query->where('home_id', '=', $team_id)
// ->orWhere('away_id', '=', $team_id);
// })
->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
if ($player_on_field == 'notplayed') {
return $query->whereNotIn('match_id', $matches_played);