public static fillInPosition ( $scores ) |
public static function fillInPosition($scores)
{
if ($scores->first() === null) {
return;
}
$position = $scores->first()->position();
foreach ($scores as $score) {
$score->position = $position;
$position++;
}
}
public function includeAllScoresBest(User $user) { return $this->item($user, function ($user) { $all = []; foreach (array_keys(Beatmap::MODES) as $mode) { $scores = $user->scoresBest($mode, true)->default()->orderBy('pp', 'DESC')->with('beatmapset', 'beatmap')->limit(100)->get(); ScoreBestModel::fillInPosition($scores); $all[$mode] = json_collection($scores, new ScoreTransformer(), 'beatmap,beatmapset,weight'); } return $all; }); }