wip
This commit is contained in:
1 parent
f6f898c207
commit
68607108b4
6 files changed
+27
-32
No files matched your search
@@ -12,7 +12,7 @@ class LoadEventsQuery
|
||||
{
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
$season = $filter['season'] ?? 0;
|
||||
$season = $filter['season'];
|
||||
$sofascore_category_id = $filter['sofascore_category_id'] ?? 0;
|
||||
$season_or_date = $filter['season_or_date'];
|
||||
$start = $filter['start_date'] ?? 0;
|
||||
@@ -85,7 +85,8 @@ class LoadEventsQuery
|
||||
* STATTISTIC DATA
|
||||
*/
|
||||
|
||||
// dd($league_id, $home_id, $away_id);
|
||||
|
||||
// dd($team_id, $home_id, $away_id);
|
||||
$res = StatistikoEvent::with('home')->with('away')
|
||||
->where(function ($query) use ($league_id, $similar_past_matches) {
|
||||
switch ($similar_past_matches) {
|
||||
@@ -97,23 +98,20 @@ class LoadEventsQuery
|
||||
->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) {
|
||||
if ($similar_past_matches == 'none') {
|
||||
if ($team_id) {
|
||||
return $query->where('home_id', '=', $team_id)
|
||||
return $query->where('home_id', $team_id)
|
||||
->orWhere('away_id', '=', $team_id);
|
||||
} else {
|
||||
return $query->where('home_id', '=', $home_id)
|
||||
->orWhere('away_id', '=', $home_id)
|
||||
->orWhere('home_id', '=', $away_id)
|
||||
->orWhere('away_id', '=', $away_id);
|
||||
return $query->whereIn('home_id', [$home_id, $away_id])->orWhereIn('away_id', [$home_id, $away_id]);
|
||||
}
|
||||
}
|
||||
})
|
||||
// ->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($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) {
|
||||
@@ -122,14 +120,15 @@ class LoadEventsQuery
|
||||
return $query->whereDate('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->whereDate('starttime', '<=', $end);
|
||||
})->when($season, function ($query) use ($season, $season_or_date) {
|
||||
})
|
||||
->when($season, function ($query) use ($season, $season_or_date) {
|
||||
if ($season_or_date == 'season')
|
||||
return $query->whereIn('season', $season);
|
||||
})
|
||||
->orderBy('starttime', 'ASC')
|
||||
->get();
|
||||
|
||||
// dd($res);
|
||||
// dd($season, $res);
|
||||
|
||||
$arr = [];
|
||||
foreach ($res as $value) {
|
||||
|
||||
Reference in new issue
Block a user