Skip to content

Commit 42399d5

Browse files
authored
Update broadcasting.md (#1)
1 parent 93329eb commit 42399d5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

broadcasting.md

+15
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Broadcast Name](#broadcast-name)
1010
- [Broadcast Data](#broadcast-data)
1111
- [Broadcast Queue](#broadcast-queue)
12+
- [Broadcast Condition](#broadcast-condition)
1213
- [Authorizing Channels](#authorizing-channels)
1314
- [Defining Authorization Routes](#defining-authorization-routes)
1415
- [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
298299
{
299300
//
300301
}
302+
<a name="broadcast-condition"></a>
303+
### Broadcast Condition
304+
305+
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:
306+
307+
/**
308+
* Check if this event should be broadcasted.
309+
*
310+
* @return bool
311+
*/
312+
public function broadcastWhen()
313+
{
314+
return $this->value > 100;
315+
}
301316

302317
<a name="authorizing-channels"></a>
303318
## Authorizing Channels

0 commit comments

Comments
 (0)