Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/core/src/Database/Eloquent/Relations/MorphPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Hypervel\Database\Eloquent\Concerns\HasAttributes;
use Hypervel\Database\Eloquent\Concerns\HasCallbacks;
use Hypervel\Database\Eloquent\Concerns\HasObservers;
use Psr\EventDispatcher\StoppableEventInterface;

class MorphPivot extends BaseMorphPivot
{
Expand All @@ -29,8 +30,10 @@ public function delete(): mixed
}

// For composite key pivots, manually fire events around the raw delete
if ($this->fireModelEvent('deleting') === false) {
return 0;
if ($event = $this->fireModelEvent('deleting')) {
if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
return 0;
}
}

$query = $this->getDeleteQuery();
Expand Down
7 changes: 5 additions & 2 deletions src/core/src/Database/Eloquent/Relations/Pivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Hypervel\Database\Eloquent\Concerns\HasAttributes;
use Hypervel\Database\Eloquent\Concerns\HasCallbacks;
use Hypervel\Database\Eloquent\Concerns\HasObservers;
use Psr\EventDispatcher\StoppableEventInterface;

class Pivot extends BasePivot
{
Expand All @@ -28,8 +29,10 @@ public function delete(): mixed
}

// For composite key pivots, manually fire events around the raw delete
if ($this->fireModelEvent('deleting') === false) {
return 0;
if ($event = $this->fireModelEvent('deleting')) {
if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
return 0;
}
}

$result = $this->getDeleteQuery()->delete();
Expand Down