diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index 8bb36a1d..32a9abef 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -8,7 +8,6 @@ use App\Models\SofaScorePlayerPosition; use App\Models\SofaScoreRosa; use App\Models\SsLineupMemory; use App\Models\StatisticFixtures; -use App\Models\StatistikoDetail; use Filament\Notifications\Notification; use Filament\Widgets\Widget; use Illuminate\Support\Facades\Auth; @@ -345,11 +344,11 @@ class PlayerPropsDrop extends Widget $asp_team = (float) $res->exp_away; } - $player = StatistikoDetail::where('ss_team_id', (int) $team_id)->where('is_active', 1)->get(); + $player_totals = SofaScorePlayerPerSeason::with('details')->where('total_min', '>', 0)->where('season', 'total')->where('ss_team_id', $team_id)->get(); $count_player = 0; - foreach ($player as $key => $value) { - if ($value['position'] != 'GK' and $value['is_active'] == 1) { + foreach ($player_totals as $key => $value) { + if ($value->details->position != 'GK' && (int) $value->details->is_active != 0) { $count_player++; } } @@ -360,10 +359,6 @@ class PlayerPropsDrop extends Widget $asp_team_riferimento = (float) $asp_team * $count_player / 10; - // dd($player->count(), $asp_team_riferimento); - - $player_totals = SofaScorePlayerPerSeason::with('details')->where('season', 'total')->where('ss_team_id', $team_id)->get(); - /*** "id" => 35067 "ss_player_id" => 233856 @@ -383,8 +378,11 @@ class PlayerPropsDrop extends Widget "shots_on_target" => 1 "shots_off_target" => 0 */ + $results = []; + $this->calculationVariables = []; + foreach ($player_totals as $val) { if ($val->details && $val->details->is_active) { @@ -507,7 +505,7 @@ class PlayerPropsDrop extends Widget } } - Log::debug('results', $results); + // Log::debug('results', $results); $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; foreach ($bettypes as $bettype) {