1111/**
1212 * BroadcastManager override that always re-resolves the broadcasters in static::$tenantBroadcasters
1313 * when attempting to retrieve them and passes the channels of the original (central) broadcaster
14- * to the broadcasters newly resolved in tenant context .
14+ * to the newly resolved ( tenant) broadcasters .
1515 *
1616 * Affects calls that use app(BroadcastManager::class)->get().
1717 *
@@ -23,19 +23,21 @@ class TenancyBroadcastManager extends BroadcastManager
2323 * Names of broadcasters that
2424 * - should always be recreated using $this->resolve(), even when they're cached and available
2525 * in $this->drivers so that when you update broadcasting config in the tenant context,
26- * the updated config/credentials will be used for broadcasting in the same context .
27- * Note that in cases like this, only direct config changes are reflected immediately .
26+ * the updated config/credentials will be used for broadcasting immediately .
27+ * Note that in cases like this, only direct config changes are reflected right away .
2828 * For the broadcasters to reflect tenant property changes made in tenant context,
2929 * you still have to reinitialize tenancy after updating the tenant properties intended
30- * for broadcasting config mapping, since the properties are only mapped to config on BroadcastingConfigBootstrapper::bootstrap().
30+ * to be mapped to broadcasting config, since the properties are only mapped to config
31+ * on BroadcastingConfigBootstrapper::bootstrap().
3132 * - should inherit the original broadcaster's channels (= the channels registered in
3233 * the central context, e.g. in routes/channels.php, before this manager overrides the bound BroadcastManager).
3334 */
3435 public static array $ tenantBroadcasters = ['pusher ' , 'ably ' ];
3536
3637 /**
3738 * Override the get method so that the broadcasters in static::$tenantBroadcasters
38- * receive the original (central) broadcaster's channels and always get freshly resolved.
39+ * - receive the original (central) broadcaster's channels
40+ * - always get freshly resolved.
3941 */
4042 protected function get ($ name )
4143 {
@@ -45,9 +47,10 @@ protected function get($name)
4547 $ newBroadcaster = $ this ->resolve ($ name );
4648
4749 // Give the channels of the original (central) broadcaster to the newly resolved one.
50+ //
4851 // Broadcasters only have to implement the Illuminate\Contracts\Broadcasting\Broadcaster contract
49- // which doesn't require the channels property, so passing the channels is only
50- // needed for Illuminate\Broadcasting\Broadcasters\Broadcaster instances.
52+ // which doesn't require the channels property, so passing the channels is only needed for
53+ // Illuminate\Broadcasting\Broadcasters\Broadcaster instances (= all the default broadcasters, e.g. PusherBroadcaster) .
5154 if ($ originalBroadcaster instanceof Broadcaster && $ newBroadcaster instanceof Broadcaster) {
5255 $ this ->passChannelsFromOriginalBroadcaster ($ originalBroadcaster , $ newBroadcaster );
5356 }
@@ -58,10 +61,12 @@ protected function get($name)
5861 return parent ::get ($ name );
5962 }
6063
61- // The newly resolved broadcasters don't automatically receive the channels registered
62- // in central context (e.g. Broadcast::channel() in routes/channels.php), so the channels
63- // have to be obtained from the original (central) broadcaster and manually passed to the new broadcasters
64- // (broadcasting using a broadcaster with no channels results in a 403 error on Broadcast::auth()).
64+ /**
65+ * The newly resolved broadcasters don't automatically receive the channels registered
66+ * in central context (e.g. Broadcast::channel() in routes/channels.php), so the channels
67+ * have to be obtained from the original (central) broadcaster and manually passed to the new broadcasters
68+ * (broadcasting using a broadcaster with no channels results in a 403 error on Broadcast::auth()).
69+ */
6570 protected function passChannelsFromOriginalBroadcaster (Broadcaster $ originalBroadcaster , Broadcaster $ newBroadcaster ): void
6671 {
6772 // invade() because channels can't be retrieved through any of the broadcaster's public methods
0 commit comments