Skip to content

Commit 9c3b36d

Browse files
author
phoenix
committed
fix -- BelongsToHandler support of mute events for old laravel versions
1 parent 3edca08 commit 9c3b36d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Domain/Relation/Handlers/BelongsToHandler.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public function attach( $model, $relationship, $value): void
1717
throw new DomainException('Can`t use BelongsTo relation with multiple select.');
1818
}
1919

20+
$dispatcher = $model->getEventDispatcher();
21+
22+
$model->unsetEventDispatcher();
23+
2024
if(intval($value) > 0)
2125
{
2226
$relationModel = $model->{$relationship}()->getModel();
@@ -28,7 +32,9 @@ public function attach( $model, $relationship, $value): void
2832
$model->{$relationship}()->dissociate();
2933
}
3034

31-
$model->saveQuietly();
35+
$model->save();
36+
37+
$model->setEventDispatcher($dispatcher);
3238
}
3339

3440
public function retrieve($model, $relationship, $idKey)

0 commit comments

Comments
 (0)