mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 20:54:02 +00:00
BroadcastingConfigBootstrapper: make tenant manager inherit central manager's custom creators
This commit is contained in:
parent
fafd082261
commit
c653c51928
1 changed files with 10 additions and 2 deletions
|
|
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue