This commit is contained in:
salam committed 2026-05-22 16:52:24 +02:00
1 parent a1f1385e75
commit 33111fe604
1 file changed
+9
+9
View File
@@ -6,6 +6,8 @@ use App\Models\StatistikoPlayer;
class PlayerLoad class PlayerLoad
{ {
public static $last_query = [];
public static function load($filter) public static function load($filter)
{ {
// dd($filter); // dd($filter);
@@ -49,6 +51,10 @@ class PlayerLoad
$player_on_field = $filter['player_on_field']; $player_on_field = $filter['player_on_field'];
if ($this->$last_query) {
$res = $this->$last_query;
} else {
$res = StatistikoPlayer::with('event')->where('tm_player_id', $tm_player_id) $res = StatistikoPlayer::with('event')->where('tm_player_id', $tm_player_id)
->when($team_position, function ($query) use ($team_id, $team_position) { ->when($team_position, function ($query) use ($team_id, $team_position) {
/** /**
@@ -78,6 +84,9 @@ class PlayerLoad
})->get(); })->get();
$this->$last_query = $res;
}
$statistic_type = $filter['statistic_type'] ?? 0; $statistic_type = $filter['statistic_type'] ?? 0;
// $fields = 'goals,fouls,offsides,shots_on_target,shots_off_target, subtype_event_during_the_match'; // $fields = 'goals,fouls,offsides,shots_on_target,shots_off_target, subtype_event_during_the_match';