Skip to content

Commit

Permalink
Use singleton for country lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaya committed Nov 15, 2024
1 parent cebf58b commit 546f90c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/Libraries/User/CountryChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

use App\Exceptions\InvariantException;
use App\Models\Beatmap;
use App\Models\Country;
use App\Models\User;
use App\Models\UserAccountHistory;

Expand All @@ -18,7 +17,7 @@ class CountryChange
public static function handle(User $user, string $newCountry, string $reason): void
{
// Assert valid country acronym
$country = Country::find($newCountry);
$country = app('countries')->byCode($newCountry);
if ($country === null) {
throw new InvariantException('invalid country specified');
}
Expand Down

0 comments on commit 546f90c

Please sign in to comment.