Skip to content

Commit

Permalink
Merge pull request #9579 from nanaya/score-url
Browse files Browse the repository at this point in the history
Fix score url
  • Loading branch information
notbakaneko authored Dec 2, 2022
2 parents 5e884bc + 90ce078 commit 6ce1af0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions app/Models/Score/Best/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public function macroForListing()
};
}

public function url(): string
{
return route('scores.show-legacy', ['mode' => $this->getMode(), 'score' => $this->getKey()]);
}

public function userRank($options)
{
// laravel model has a $hidden property
Expand Down
5 changes: 0 additions & 5 deletions app/Models/Score/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ public function getMode(): string
return snake_case(get_class_basename(static::class));
}

public function url()
{
return route('scores.show', ['mode' => $this->getMode(), 'score' => $this->getKey()]);
}

protected function getData()
{
$mods = array_map(fn ($m) => ['acronym' => $m, 'settings' => []], $this->enabled_mods);
Expand Down
5 changes: 5 additions & 0 deletions app/Models/Solo/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public function trashed(): bool
return false;
}

public function url(): string
{
return route('scores.show', $this);
}

public function userRank(?array $params = null): int
{
return UserRank::getRank(ScoreSearchParams::fromArray(array_merge($params ?? [], [
Expand Down

0 comments on commit 6ce1af0

Please sign in to comment.