diff --git a/published/config.stub b/published/config.stub index 082e8cc..2ec1dc6 100644 --- a/published/config.stub +++ b/published/config.stub @@ -66,4 +66,11 @@ return [ Sofa\ModelLocking\ModelLocked::class => null, Sofa\ModelLocking\ModelUnlocked::class => null, ], + + /* + |-------------------------------------------------------------------------- + | Enable event broadcasting? + |-------------------------------------------------------------------------- + */ + 'enable_broadcasting' => true, ]; diff --git a/src/LockEvent.php b/src/LockEvent.php index 06a3722..3b4b9bf 100644 --- a/src/LockEvent.php +++ b/src/LockEvent.php @@ -49,4 +49,14 @@ public function broadcastAs() { return config('model_locking.broadcast_as.'.static::class) ?: static::class; } + + /** + * Determine if this event should broadcast. + * + * @return bool + */ + public function broadcastWhen() + { + return config('model_locking.enable_broadcasting'); + } }