1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-08-06 09:34:03 +00:00

Delete $broadcaster property from the config bootstrapper, stop overriding the static properties in the constructor

The $broadcaster property essentially had no real purpose, and there's no reason to override the static properties in the constructor. Instead of that, just get the credentials map in setConfig
This commit is contained in:
lukinovec 2026-07-21 11:56:03 +02:00
parent 4e9f8a3c3e
commit 8a5f5438ff
2 changed files with 7 additions and 25 deletions

View file

@ -31,8 +31,6 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper
*/
public static array $credentialsMap = [];
public static string|null $broadcaster = null;
protected array $originalConfig = [];
protected BroadcastManager|null $originalBroadcastManager = null;
protected BroadcasterContract|null $originalBroadcaster = null;
@ -59,10 +57,7 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper
public function __construct(
protected Repository $config,
protected Application $app
) {
static::$broadcaster ??= $config->get('broadcasting.default');
static::$credentialsMap = array_merge(static::$mapPresets[static::$broadcaster] ?? [], static::$credentialsMap);
}
) {}
public function bootstrap(Tenant $tenant): void
{
@ -147,7 +142,12 @@ class BroadcastingConfigBootstrapper implements TenancyBootstrapper
protected function setConfig(Tenant $tenant): void
{
foreach (static::$credentialsMap as $configKey => $storageKey) {
$credentialsMap = array_merge(
static::$mapPresets[$this->config->get('broadcasting.default')] ?? [],
static::$credentialsMap,
);
foreach ($credentialsMap as $configKey => $storageKey) {
$override = $tenant->$storageKey;
if (array_key_exists($storageKey, $tenant->getAttributes())) {