From 937c8c87d981854ed3e7ca4a3a382a4f056d4f32 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Fri, 10 Jul 2026 11:07:30 +0200 Subject: [PATCH] Delete the redundant BroadcastingFactory::class arg from the Broadcast::clearResolvedInstance calls Also in bootstrap(), update the clearResolvedInstance comment. Remove the FQCN mention and explain why exactly do we need to clear the resolved instance --- src/Bootstrappers/BroadcastingConfigBootstrapper.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Bootstrappers/BroadcastingConfigBootstrapper.php b/src/Bootstrappers/BroadcastingConfigBootstrapper.php index 0f1c632a..f9ccb112 100644 --- a/src/Bootstrappers/BroadcastingConfigBootstrapper.php +++ b/src/Bootstrappers/BroadcastingConfigBootstrapper.php @@ -7,7 +7,6 @@ namespace Stancl\Tenancy\Bootstrappers; use Illuminate\Broadcasting\BroadcastManager; use Illuminate\Config\Repository; use Illuminate\Contracts\Broadcasting\Broadcaster; -use Illuminate\Contracts\Broadcasting\Factory as BroadcastingFactory; use Illuminate\Foundation\Application; use Illuminate\Support\Facades\Broadcast; use Stancl\Tenancy\Contracts\TenancyBootstrapper; @@ -103,10 +102,10 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper return $this->app->make(BroadcastManager::class)->connection(); }); - // Clear the resolved Broadcast facade's Illuminate\Contracts\Broadcasting\Factory instance - // so that it gets re-resolved as TenancyBroadcastManager instead of the central BroadcastManager - // when used. E.g. the Broadcast::auth() call in BroadcastController::authenticate (/broadcasting/auth). - Broadcast::clearResolvedInstance(BroadcastingFactory::class); + // Extending the binding doesn't update the Broadcast facade's cached instance, + // so clear it to make the facade re-resolve to TenancyBroadcastManager instead of the central + // BroadcastManager — e.g. in the Broadcast::auth() call in BroadcastController (/broadcasting/auth). + Broadcast::clearResolvedInstance(); } public function revert(): void @@ -116,7 +115,7 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper $this->app->singleton(Broadcaster::class, fn (Application $app) => $this->originalBroadcaster); // Clear the resolved Broadcast facade instance so that it gets re-resolved as the central BroadcastManager - Broadcast::clearResolvedInstance(BroadcastingFactory::class); + Broadcast::clearResolvedInstance(); $this->unsetConfig(); }