Skip to content

Commit

Permalink
Only return top 10 topscorers from current_stage league
Browse files Browse the repository at this point in the history
Only return top 10 topscorers from current_stage league
  • Loading branch information
sebastiaanspeck committed Oct 16, 2018
1 parent 6e909df commit 3053ae1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/Http/Controllers/SoccerAPI/SoccerAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ function leaguesDetails($leagueId, Request $request)

if($league->coverage->topscorer_goals && !in_array($leagueId, $excludedLeagues)) {
$topscorers = $soccerAPI->topscorers()->setInclude($includeTopscorers)->bySeasonId($league->current_season_id)->goalscorers->data;

foreach($topscorers as $key => $topscorer) {
if($topscorer->stage_id != $league->current_stage_id) {
unset($topscorers[$key]);
}
}

$topscorers = self::addPagination($topscorers, 10);

}

$lastFixtures = [];
Expand Down

0 comments on commit 3053ae1

Please sign in to comment.