diff --git a/broadcasting.md b/broadcasting.md index 9ef54a764b9..0609584a37d 100644 --- a/broadcasting.md +++ b/broadcasting.md @@ -9,6 +9,7 @@ - [Broadcast Name](#broadcast-name) - [Broadcast Data](#broadcast-data) - [Broadcast Queue](#broadcast-queue) + - [Broadcast Condition](#broadcast-condition) - [Authorizing Channels](#authorizing-channels) - [Defining Authorization Routes](#defining-authorization-routes) - [Defining Authorization Callbacks](#defining-authorization-callbacks) @@ -298,6 +299,20 @@ If you want to broadcast your event using the `sync` queue instead of the defaul { // } + +### Broadcast Condition + +Sometimes you need to broadcast your event only if some requirements are met. You may set these checks by defining a `broadcastWhen` method on your event class: + + /** + * Check if this event should be broadcasted. + * + * @return bool + */ + public function broadcastWhen() + { + return $this->value > 100; + } ## Authorizing Channels