mirror of
https://github.com/archtechx/tenancy.git
synced 2026-08-06 23:54:04 +00:00
Explain why we swap the bound Broadcaster singleton better, remove the invalid "notification sending" example
This commit is contained in:
parent
f20f8016d8
commit
9af173553e
1 changed files with 6 additions and 5 deletions
|
|
@ -93,11 +93,12 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper
|
||||||
return $tenantBroadcastManager;
|
return $tenantBroadcastManager;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Swap currently bound Broadcaster instance for one that's resolved through the tenant BroadcastManager.
|
// Swap the currently bound Broadcaster singleton (resolved earlier with the central credentials)
|
||||||
// Note that updating broadcasting config (credentials) in tenant context doesn't update the credentials
|
// for one resolved through the tenant BroadcastManager, so that anything resolving the Broadcaster
|
||||||
// used by the bound Broadcaster instance. If you need to e.g. send a notification in response to
|
// contract gets a broadcaster that uses the tenant's credentials instead of the stale central one.
|
||||||
// updating tenant's broadcasting credentials in tenant context, it's recommended to
|
// Unlike broadcasters resolved through the manager (re-resolved on each call), this instance is
|
||||||
// reinitialize tenancy after updating the credentials.
|
// resolved once, so credential changes made later in tenant context don't affect it until tenancy
|
||||||
|
// is reinitialized.
|
||||||
$this->app->extend(Broadcaster::class, function () {
|
$this->app->extend(Broadcaster::class, function () {
|
||||||
return $this->app->make(BroadcastManager::class)->connection();
|
return $this->app->make(BroadcastManager::class)->connection();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue