diff --git a/src/Concerns/GiveExperience.php b/src/Concerns/GiveExperience.php index c66f044..3c1ec2f 100644 --- a/src/Concerns/GiveExperience.php +++ b/src/Concerns/GiveExperience.php @@ -64,14 +64,11 @@ public function addPoints( */ if ($this->experience()->doesntExist()) { $level = Level::query() - ->where(column: 'next_level_experience', operator: '<=', value: $amount) - ->orderByDesc(column: 'next_level_experience') - ->first(); + ->firstWhere(column: 'next_level_experience', operator: '<=', value: $amount) + ->orderByDesc(column: 'next_level_experience'); if ($level === null) { - $level = Level::query() - ->where(column: 'level', operator: '=', value: config(key: 'level-up.starting_level')) - ->first(); + $level = Level::firstWhere(column: 'level', operator: '=', value: config(key: 'level-up.starting_level')); } $experience = $this->experience()->create(attributes: [