wip player filter

This commit is contained in:
salam committed 2026-06-25 20:25:06 +02:00
1 parent 12d29c7b3e
commit 74e9285bac
4 files changed
+30 -21

No files matched your search

+14 -8
View File
@@ -4,14 +4,18 @@ namespace App\Actions\Selections;
use App\Models\StatistikoDetail;
use App\Models\StatistikoPlayer;
use Illuminate\Support\Facades\Log;
class LoadPlayer
{
public static function load($team_id)
public static function load($get)
{
// $res = CompetitionGroup::with('country')->where('id', $league_id)->first();
// $season_mode = $res->country->season_mode;
$team_id = $get('team_id');
$season = $get('season');
$res_details = StatistikoDetail::where('txodds_id', $team_id)->get();
if (! $res_details) {
@@ -23,17 +27,19 @@ class LoadPlayer
$player_ids[] = $val->tm_player_id;
}
$res_player = StatistikoPlayer::whereIn('tm_player_id', $player_ids)
->with('event')
->where('minutes_played', '>', 0)
->select('match_id','tm_player_id')
->get();
$counting = [];
foreach ($res_player as $val) {
$tm_player_id = $val->tm_player_id;
if(!isset($counting[$tm_player_id])){
$counting[$tm_player_id] = 1;
}else {
$counting[$tm_player_id]++;
if(in_array($val->event->season, $season)){
$tm_player_id = $val->tm_player_id;
if(!isset($counting[$tm_player_id])){
$counting[$tm_player_id] = 1;
}else {
$counting[$tm_player_id]++;
}
}
}
@@ -63,4 +69,4 @@ class LoadPlayer
}
return $arr;
}
}
}