wip
This commit is contained in:
1 parent
087b0a2a1a
commit
90b1dfdc4f
6 files changed
+57
-40
No files matched your search
@@ -8,6 +8,7 @@ use App\Models\StatistikoDetail;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LoadEvents
|
||||
{
|
||||
@@ -20,7 +21,7 @@ class LoadEvents
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
$season_or_date = $filter['season_or_date'] ?? 'season';
|
||||
|
||||
|
||||
$season = $filter['season'] ?? 0;
|
||||
|
||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
||||
@@ -95,7 +96,7 @@ class LoadEvents
|
||||
*/
|
||||
$matches_played = [];
|
||||
$description = '';
|
||||
|
||||
|
||||
if ($tm_player_id) {
|
||||
|
||||
$matches_season = StatistikoEvent::where(function ($query) use ($team_id, $team_position) {
|
||||
@@ -110,15 +111,15 @@ class LoadEvents
|
||||
}
|
||||
})->pluck('match_id')->toArray();
|
||||
|
||||
|
||||
|
||||
$matches_played = StatistikoPlayer::query()
|
||||
->whereIn('match_id', $matches_season)
|
||||
->where('tm_player_id', '=', (int) $tm_player_id)
|
||||
->when($player_on_field, function ($query) use ($player_on_field) {
|
||||
// 'all' => 'All',
|
||||
// 'lineup' => 'Lineup',
|
||||
// 'substituted' => 'Substituted',
|
||||
// 'notplayed' => 'Not Played',
|
||||
// 'all' => 'All',
|
||||
// 'lineup' => 'Lineup',
|
||||
// 'substituted' => 'Substituted',
|
||||
// 'notplayed' => 'Not Played',
|
||||
switch ($player_on_field) {
|
||||
case 'all':
|
||||
return $query->where('minutes_played', '>', 0);
|
||||
@@ -164,9 +165,9 @@ class LoadEvents
|
||||
}
|
||||
}
|
||||
})->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
|
||||
if($player_on_field == 'notplayed'){
|
||||
if ($player_on_field == 'notplayed') {
|
||||
return $query->whereNotIn('match_id', $matches_played);
|
||||
}else {
|
||||
} else {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
}
|
||||
})->when($handicap_range, function ($query) use ($handicap_range) {
|
||||
@@ -177,7 +178,7 @@ class LoadEvents
|
||||
return $query->where('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})->when($season , function ($query) use ($season) {
|
||||
})->when($season, function ($query) use ($season) {
|
||||
return $query->whereIn('season', $season);
|
||||
})
|
||||
->orderBy('starttime', 'ASC')
|
||||
@@ -187,6 +188,9 @@ class LoadEvents
|
||||
return [];
|
||||
}
|
||||
|
||||
// Log::debug($res->toArray());
|
||||
|
||||
|
||||
$dataset_home = [];
|
||||
$dataset_away = [];
|
||||
$dataset_exp_home = [];
|
||||
@@ -201,6 +205,10 @@ class LoadEvents
|
||||
|
||||
// dd($value);
|
||||
|
||||
// $result_code = (string) $value['result_code'];
|
||||
|
||||
// Log::debug($result_code);
|
||||
|
||||
$labels[] = round($value['starttime']->diffInDays(Carbon::now()));
|
||||
|
||||
$playing_date[] = $value['starttime']->format('d. F Y H:i');
|
||||
|
||||
Reference in new issue
Block a user