Skip to content

Commit 69a4d35

Browse files
committed
delete any scheduled action when main model is deleted
1 parent 2b4998f commit 69a4d35

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Traits/HasActions.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77

88
trait HasActions
99
{
10+
protected static function booted()
11+
{
12+
parent::booted();
13+
14+
static::deleting(function ($model) {
15+
$model->scheduledActions()->delete();
16+
});
17+
}
18+
1019
public function scheduledActions(): MorphMany
1120
{
1221
return $this->morphMany(ModelAction::class, 'actionable');

0 commit comments

Comments
 (0)