Skip to content

Commit

Permalink
Merge pull request #26 from cjmellor/24-bug-$user-nextlevelat-returni…
Browse files Browse the repository at this point in the history
…ng-0

Possible `nextLevelAt()` Bug
  • Loading branch information
cjmellor authored Aug 20, 2023
2 parents 9fb87cd + bee9aaa commit 72f14d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Concerns/GiveExperience.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public function withMultiplierData(array $data): static

public function nextLevelAt(int $checkAgainst = null, bool $showAsPercentage = false): int
{
$nextLevel = Level::firstWhere(column: 'level', operator: '=', value: $checkAgainst ?? $this->getLevel() + 1);
// $nextLevel = Level::firstWhere(column: 'level', operator: '=', value: $checkAgainst ?? $this->getLevel() + 1);
$nextLevel = Level::firstWhere(column: 'level', operator: '=', value: is_null($checkAgainst) ? $this->getLevel() + 1 : $checkAgainst);

if (! $nextLevel || $nextLevel->next_level_experience === null) {
return 0;
Expand Down

0 comments on commit 72f14d6

Please sign in to comment.