From 5cf6ec20dc74e4eac8215a3d680623d5fafb641c Mon Sep 17 00:00:00 2001 From: salam Date: Thu, 18 Jun 2026 17:17:52 +0200 Subject: [PATCH] wip --- app/Actions/Selections/LoadPlayer.php | 26 ++++++++++++++++++++ app/Actions/{ => Selections}/LoadSeasons.php | 4 +-- app/Filament/Pages/Statistic.php | 5 ++-- 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 app/Actions/Selections/LoadPlayer.php rename app/Actions/{ => Selections}/LoadSeasons.php (87%) diff --git a/app/Actions/Selections/LoadPlayer.php b/app/Actions/Selections/LoadPlayer.php new file mode 100644 index 00000000..52032365 --- /dev/null +++ b/app/Actions/Selections/LoadPlayer.php @@ -0,0 +1,26 @@ +where('id', $league_id)->first(); + // $season_mode = $res->country->season_mode; + + $res = StatistikoDetail::where('txodds_id', $team_id)->get(); + + if (! $res) { + return []; + } + + $arr = []; + foreach ($res as $val) { + $arr[$val->position][$val->tm_player_id] = $val->name; + } + return $arr; + } +} diff --git a/app/Actions/LoadSeasons.php b/app/Actions/Selections/LoadSeasons.php similarity index 87% rename from app/Actions/LoadSeasons.php rename to app/Actions/Selections/LoadSeasons.php index 3e5c398e..81abfa9e 100644 --- a/app/Actions/LoadSeasons.php +++ b/app/Actions/Selections/LoadSeasons.php @@ -1,9 +1,7 @@ preload() ->options(function (Get $get) { - return StatistikoDetail::where('txodds_id', $get('team_id'))->pluck('name', 'tm_player_id'); + return LoadPlayer::load($get('team_id')); }) ->live(), Select::make('player_on_field')