wip
This commit is contained in:
1 parent
8d6107320a
commit
6eeef19fd9
1 file changed
+31
-10
@@ -101,23 +101,44 @@ class LoadEvents
|
|||||||
/**
|
/**
|
||||||
* IF WITH PLAYER
|
* IF WITH PLAYER
|
||||||
*/
|
*/
|
||||||
$matches_played = 0;
|
$matches_played = [];
|
||||||
$description = '';
|
$description = '';
|
||||||
if ($tm_player_id) {
|
if ($tm_player_id) {
|
||||||
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)
|
// $matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)
|
||||||
->when($player_on_field, function ($query) use ($player_on_field) {
|
// ->when($player_on_field, function ($query) use ($player_on_field) {
|
||||||
|
// switch ($player_on_field) {
|
||||||
|
// case 'lineup':
|
||||||
|
// 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) {
|
switch ($player_on_field) {
|
||||||
|
case 'all':
|
||||||
|
$matches_played[] = $value->match_id;
|
||||||
|
break;
|
||||||
case 'lineup':
|
case 'lineup':
|
||||||
return $query->where('lineup', 'T');
|
if($value->lineup == 'T'){
|
||||||
|
$matches_played[] = $value->match_id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'substituted':
|
case 'substituted':
|
||||||
return $query->where('lineup', 'P');
|
if($value->lineup == 'p'){
|
||||||
|
$matches_played[] = $value->match_id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'notplayed':
|
case 'notplayed':
|
||||||
return $query->where('minutes_played', 0);
|
if(!$value->minutes_played){
|
||||||
|
$matches_played[] = $value->match_id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
->pluck('match_id')->toArray();
|
|
||||||
|
|
||||||
// dd($matches_played);
|
|
||||||
|
|
||||||
$description = ' with ' . StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name') . ' (' . \count($matches_played) . ')';
|
$description = ' with ' . StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name') . ' (' . \count($matches_played) . ')';
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user