Skip to content

Commit

Permalink
[10.x] Mark model instanse as not exists on deleting MorphPivot relat…
Browse files Browse the repository at this point in the history
…ion. (#50135)

* Mark model instanse as not exists on deleting MorphPivot relation.

On deleted event, the model is marked as existing.
Like in AsPivot::delete()

* Update MorphPivot.php
  • Loading branch information
dkulyk authored Feb 19, 2024
1 parent cf95132 commit 85b2878
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/MorphPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public function delete()
$query->where($this->morphType, $this->morphClass);

return tap($query->delete(), function () {
$this->exists = false;

$this->fireModelEvent('deleted', false);
});
}
Expand Down

0 comments on commit 85b2878

Please sign in to comment.