diff --git a/app/Console/Commands/UpdateCelebritiesList.php b/app/Console/Commands/UpdateCelebritiesList.php index c0fef71..563f628 100644 --- a/app/Console/Commands/UpdateCelebritiesList.php +++ b/app/Console/Commands/UpdateCelebritiesList.php @@ -30,7 +30,7 @@ public function handle(CreateUserAchievement $createUserAchievement) ->whereIn('followers_count', $topTenFollowersCount) ->get(); - $achievement = Achievement::getById(8); + $achievement = Achievement::getByName('celebrity'); UserAchievement::query() ->where('achievement_id', $achievement['id']) diff --git a/app/Services/Achievement.php b/app/Services/Achievement.php index 01b18fb..49e96ce 100644 --- a/app/Services/Achievement.php +++ b/app/Services/Achievement.php @@ -15,6 +15,13 @@ public static function getByPassedDays(int $days): ?array }); } + public static function getByName(string $name): array + { + $achievements = config('hope.achievements'); + + return Arr::first($achievements, fn ($achievement) => $achievement['name'] === $name); + } + public static function getById(int $id): array { return config('hope.achievements')[$id];