wip
This commit is contained in:
1 parent
0bfb0810f8
commit
c97d4deb5c
1 file changed
+7
-28
@@ -103,6 +103,7 @@ class LoadEvents
|
||||
*/
|
||||
$matches_played = [];
|
||||
$description = '';
|
||||
// dd($tm_player_id); 613873
|
||||
if ($tm_player_id) {
|
||||
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)
|
||||
->when($player_on_field, function ($query) use ($player_on_field) {
|
||||
@@ -111,35 +112,9 @@ class LoadEvents
|
||||
return $query->where('lineup', 'T');
|
||||
case 'substituted':
|
||||
return $query->where('lineup', 'P');
|
||||
case 'notplayed':
|
||||
return $query->where('minutes_played', 0);
|
||||
}
|
||||
})
|
||||
->pluck('match_id')->toArray();
|
||||
// $res = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)->get();
|
||||
// foreach ($res as $value) {
|
||||
// switch ($player_on_field) {
|
||||
// case 'all':
|
||||
// $matches_played[] = $value->match_id;
|
||||
// break;
|
||||
// case 'lineup':
|
||||
// if($value->lineup == 'T'){
|
||||
// $matches_played[] = $value->match_id;
|
||||
// }
|
||||
// break;
|
||||
// case 'substituted':
|
||||
// if($value->lineup == 'p'){
|
||||
// $matches_played[] = $value->match_id;
|
||||
// }
|
||||
// break;
|
||||
// case 'notplayed':
|
||||
// if(!$value->minutes_played){
|
||||
// $matches_played[] = $value->match_id;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
$description = ' with ' . StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name') . ' (' . \count($matches_played) . ')';
|
||||
|
||||
if (! $matches_played) {
|
||||
@@ -170,8 +145,12 @@ class LoadEvents
|
||||
->orWhere('away_id', '=', $team_id);
|
||||
}
|
||||
}
|
||||
})->when($matches_played, function ($query) use ($matches_played) {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
})->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
|
||||
if($player_on_field == 'notplayed'){
|
||||
return $query->whereNotIn('match_id', $matches_played);
|
||||
}else {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
}
|
||||
})->when($handicap_range, function ($query) use ($handicap_range) {
|
||||
return $query->whereBetween('exp_handicap', $handicap_range);
|
||||
})->when($total_range, function ($query) use ($total_range) {
|
||||
|
||||
Reference in new issue
Block a user