Skip to content

Commit

Permalink
Fix N+1 issue #8
Browse files Browse the repository at this point in the history
  • Loading branch information
mchev committed Jun 10, 2023
1 parent 37a0210 commit 2a305a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Traits/Bannable.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public function bans(): MorphMany
*/
public function isBanned(): bool
{
return $this->bans()
->notExpired()
->exists();
return $this->bans->filter(function ($ban) {
return $ban->notExpired();
})->isNotEmpty();
}

/**
Expand Down

0 comments on commit 2a305a8

Please sign in to comment.