1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 16:24:03 +00:00

BroadcastingConfigBootstrapper: make tenant manager inherit central manager's custom creators

This commit is contained in:
lukinovec 2026-03-31 16:22:41 +02:00
parent fafd082261
commit c653c51928

View file

@ -64,9 +64,17 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper
$this->setConfig($tenant); $this->setConfig($tenant);
// Make BroadcastManager resolve to a custom BroadcastManager which makes the broadcasters use the tenant credentials // Make BroadcastManager resolve to a custom BroadcastManager which makes the broadcasters use the tenant credentials.
// TenantBroadcastManager also inherits the custom drivers registered in the original BroadcastManager, so that they can be used in tenant context as well.
$this->app->extend(BroadcastManager::class, function (BroadcastManager $broadcastManager) { $this->app->extend(BroadcastManager::class, function (BroadcastManager $broadcastManager) {
return new TenancyBroadcastManager($this->app); $originalCustomCreators = invade($broadcastManager)->customCreators;
$tenantBroadcastManager = new TenancyBroadcastManager($this->app);
foreach ($originalCustomCreators as $driver => $closure) {
$tenantBroadcastManager->extend($driver, $closure);
}
return $tenantBroadcastManager;
}); });
} }