From c07996ede0116f979dfe8e08fb9feba2c1744e56 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Mon, 13 Jul 2026 17:19:16 +0200 Subject: [PATCH] Explain extending BroadcasterContract better --- src/Bootstrappers/BroadcastingConfigBootstrapper.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Bootstrappers/BroadcastingConfigBootstrapper.php b/src/Bootstrappers/BroadcastingConfigBootstrapper.php index 1fe91f77..9fffc7fe 100644 --- a/src/Bootstrappers/BroadcastingConfigBootstrapper.php +++ b/src/Bootstrappers/BroadcastingConfigBootstrapper.php @@ -89,6 +89,9 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper // Swap the currently bound Broadcaster singleton (resolved earlier with the central credentials) // for the tenant BroadcastManager's default broadcaster, so that anything resolving the Broadcaster // contract gets the same tenant broadcaster that the manager uses, instead of the stale central one. + // The closure runs immediately (the extended singleton is already resolved), and it's also what makes + // channel auth work in tenant context -- the broadcaster resolved here gets cached as the tenant + // manager's default driver and receives the central channel auth closures (see below). $this->app->extend(BroadcasterContract::class, function (BroadcasterContract $centralBroadcaster) { $tenantBroadcaster = $this->app->make(BroadcastManager::class)->connection();