diff --git a/src/Database/Model.php b/src/Database/Model.php index 1f7fed123..5d51f021a 100644 --- a/src/Database/Model.php +++ b/src/Database/Model.php @@ -228,7 +228,7 @@ protected function bootNicerEvents() if ($model->methodExists($method)) { // Register the method as a listener with default priority // to allow for complete control over the execution order - $model->bindEvent('model.' . $method, [$model, $method]); + $model->bindEventOnce('model.' . $method, [$model, $method]); } // First listener that returns a non-null result will cancel the // further propagation of the event; If that result is false, the diff --git a/src/Database/Traits/SoftDelete.php b/src/Database/Traits/SoftDelete.php index 5e372a0ca..960b7f521 100644 --- a/src/Database/Traits/SoftDelete.php +++ b/src/Database/Traits/SoftDelete.php @@ -34,7 +34,7 @@ public static function bootSoftDelete() if ($model->methodExists('beforeRestore')) { // Register the method as a listener with default priority // to allow for complete control over the execution order - $model->bindEvent('model.beforeRestore', [$model, 'beforeRestore']); + $model->bindEventOnce('model.beforeRestore', [$model, 'beforeRestore']); } /** * @event model.beforeRestore @@ -54,7 +54,7 @@ public static function bootSoftDelete() if ($model->methodExists('afterRestore')) { // Register the method as a listener with default priority // to allow for complete control over the execution order - $model->bindEvent('model.afterRestore', [$model, 'afterRestore']); + $model->bindEventOnce('model.afterRestore', [$model, 'afterRestore']); } /** * @event model.afterRestore diff --git a/src/Database/Traits/Validation.php b/src/Database/Traits/Validation.php index ee3ca8ba6..c8c0472fc 100644 --- a/src/Database/Traits/Validation.php +++ b/src/Database/Traits/Validation.php @@ -65,7 +65,7 @@ public static function bootValidation() if ($model->methodExists('beforeValidate')) { // Register the method as a listener with default priority // to allow for complete control over the execution order - $model->bindEvent('model.beforeValidate', [$model, 'beforeValidate']); + $model->bindEventOnce('model.beforeValidate', [$model, 'beforeValidate']); } /** @@ -87,7 +87,7 @@ public static function bootValidation() if ($model->methodExists('afterValidate')) { // Register the method as a listener with default priority // to allow for complete control over the execution order - $model->bindEvent('model.afterValidate', [$model, 'afterValidate']); + $model->bindEventOnce('model.afterValidate', [$model, 'afterValidate']); } /** diff --git a/src/Halcyon/Model.php b/src/Halcyon/Model.php index f51c3ac47..5a9ff66d0 100644 --- a/src/Halcyon/Model.php +++ b/src/Halcyon/Model.php @@ -242,7 +242,7 @@ protected function bootNicerEvents() if ($model->methodExists($method)) { // Register the method as a listener with default priority // to allow for complete control over the execution order - $model->bindEvent('model.' . $method, [$model, $method]); + $model->bindEventOnce('model.' . $method, [$model, $method]); } // First listener that returns a non-null result will cancel the // further propagation of the event; If that result is false, the