wip
This commit is contained in:
1 parent
96598a09aa
commit
cdc8bdfc95
3 files changed
+25
-19
No files matched your search
@@ -3,7 +3,7 @@
|
||||
namespace App\Traits\PlayerProps;
|
||||
|
||||
use App\Models\StatistikoDetail;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
// use Illuminate\Support\Facades\Log;
|
||||
@@ -27,7 +27,6 @@ trait PlayerQuery
|
||||
$arr = [];
|
||||
$res = $this->getPlayers($part, $player_ids);
|
||||
foreach ($res as $val) {
|
||||
|
||||
$ss_player_id = (int) $val->ss_player_id;
|
||||
$activeteam_id = (int) $val->activeteam_id;
|
||||
$minutes_played = (int) $val->minutes_played;
|
||||
@@ -91,7 +90,6 @@ trait PlayerQuery
|
||||
$arr = [];
|
||||
$res = $this->getPlayers(1, $player_ids);
|
||||
foreach ($res as $val) {
|
||||
|
||||
$ss_player_id = (int) $val->ss_player_id;
|
||||
$activeteam_id = (int) $val->activeteam_id;
|
||||
$minutes_played = (int) $val->minutes_played;
|
||||
@@ -184,30 +182,41 @@ trait PlayerQuery
|
||||
$this->season_selected = $this->getCurrentSeason();
|
||||
}
|
||||
|
||||
$sesson_int_string = [];
|
||||
foreach ($this->season_selected as $value) {
|
||||
if (strpos($value, '/') !== false) {
|
||||
$sesson_int_string[] = (string) $value;
|
||||
} else {
|
||||
$sesson_int_string[] = (string) $value;
|
||||
$sesson_int_string[] = (int) $value;
|
||||
}
|
||||
}
|
||||
|
||||
return match ($part) {
|
||||
1 => StatistikoEvent::with('details')
|
||||
1 => StatistikoPlayer::with('details')
|
||||
->whereIn('ss_player_id', $player_ids)
|
||||
->when($this->season_selected, function ($query) {
|
||||
return $query->whereIn('season', $this->season_selected);
|
||||
})->pluck('match_id')->toArray(),
|
||||
2 => StatistikoEvent::with('details')
|
||||
->when($this->season_selected, function ($query) use ($sesson_int_string) {
|
||||
return $query->whereIn('season', $sesson_int_string);
|
||||
})->get(),
|
||||
2 => StatistikoPlayer::with('details')
|
||||
->whereIn('ss_player_id', $player_ids)
|
||||
->when($this->season_selected, function ($query) {
|
||||
return $query->whereNotIn('season', $this->season_selected);
|
||||
})->pluck('match_id')->toArray(),
|
||||
->when($this->season_selected, function ($query) use ($sesson_int_string) {
|
||||
return $query->whereNotIn('season', $sesson_int_string);
|
||||
})->get(),
|
||||
};
|
||||
|
||||
default:
|
||||
return match ($part) {
|
||||
1 => StatistikoEvent::with('details')
|
||||
1 => StatistikoPlayer::with('details')
|
||||
->whereIn('ss_player_id', $player_ids)
|
||||
->when($this->date_spliter, function ($query) {
|
||||
return $query->whereDate('starttime', '>', $this->date_spliter);
|
||||
})->pluck('match_id')->toArray(),
|
||||
2 => StatistikoEvent::with('details')
|
||||
})->get(),
|
||||
2 => StatistikoPlayer::with('details')
|
||||
->whereIn('ss_player_id', $player_ids)
|
||||
->when($this->season_selected, function ($query) {
|
||||
return $query->whereDate('starttime', '<=', $this->date_spliter);
|
||||
})->pluck('match_id')->toArray()
|
||||
})->get(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user