diff --git a/src/Bootstrappers/LogTenancyBootstrapper.php b/src/Bootstrappers/LogTenancyBootstrapper.php index 6089500e..9bc1899e 100644 --- a/src/Bootstrappers/LogTenancyBootstrapper.php +++ b/src/Bootstrappers/LogTenancyBootstrapper.php @@ -36,7 +36,7 @@ class LogTenancyBootstrapper implements TenancyBootstrapper * Custom channel configuration overrides. * * Examples: - * - Array mapping (the default approach): ['slack' => ['url' => 'webhookUrl']] maps $tenant->webhookUrl to slack.url (if $tenant->webhookUrl is set, otherwise, the override is ignored) + * - Array mapping (the default approach): ['slack' => ['url' => 'webhookUrl']] maps $tenant->webhookUrl to slack.url (if $tenant->webhookUrl is not null, otherwise, the override is ignored) * - Closure: ['slack' => fn ($config, $tenant) => $config->set('logging.channels.slack.url', $tenant->slackUrl)] */ public static array $channelOverrides = []; @@ -109,8 +109,8 @@ class LogTenancyBootstrapper implements TenancyBootstrapper protected function overrideChannelConfig(string $channel, array|Closure $override, Tenant $tenant): void { if (is_array($override)) { - // Map tenant properties to channel config keys. - // If the tenant property is not set (= is null), + // Map tenant attributes to channel config keys. + // If the tenant attribute is null, // the override is ignored and the channel config key's value remains unchanged. foreach ($override as $configKey => $tenantAttributeName) { $tenantAttribute = $tenant->getAttribute($tenantAttributeName); diff --git a/tests/Bootstrappers/LogTenancyBootstrapperTest.php b/tests/Bootstrappers/LogTenancyBootstrapperTest.php index bebbb841..60941892 100644 --- a/tests/Bootstrappers/LogTenancyBootstrapperTest.php +++ b/tests/Bootstrappers/LogTenancyBootstrapperTest.php @@ -135,17 +135,17 @@ test('channel overrides work correctly with both arrays and closures', function expect(config('logging.channels.slack.username'))->toBe('Default'); // Not changed at all }); -test('channel config keys remains unchanged if the specified tenant override property is not set', function() { +test('channel config keys remains unchanged if the specified tenant override attribute is null', function() { config(['logging.default' => 'slack']); config(['logging.channels.slack.username' => 'Default username']); LogTenancyBootstrapper::$channelOverrides = [ - 'slack' => ['username' => 'nonExistentProperty'], // $tenant->nonExistentProperty + 'slack' => ['username' => 'nonExistentAttribute'], // $tenant->nonExistentAttribute ]; tenancy()->initialize(Tenant::create()); - // The username should remain unchanged since the tenant property is not set + // The username should remain unchanged since the tenant attribute is null expect(config('logging.channels.slack.username'))->toBe('Default username'); });