Skip to content

Commit

Permalink
FIX exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
enricodelazzari committed Dec 5, 2023
1 parent e961d87 commit 66a2679
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Excludable.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public static function areAllExcluded(): bool
public function addToExclusion(): bool
{
return DB::transaction(function () {
if ($this->fireModelEvent('excluding') === false) {
return false;
}

$this->exclusions()->where([
'type' => Exclusion::TYPE_INCLUDE,
'excludable_type' => $this->getMorphClass(),
Expand All @@ -71,10 +75,6 @@ public function addToExclusion(): bool
return true;
}

if ($this->fireModelEvent('excluding') === false) {
return false;
}

$exclusion = $this->exclusion()->firstOrCreate([
'type' => Exclusion::TYPE_EXCLUDE,
'excludable_type' => $this->getMorphClass(),
Expand Down

0 comments on commit 66a2679

Please sign in to comment.