From 7bdbe9d880d3cad8faea01ef0346d0410aaf13f2 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Thu, 31 Jul 2025 16:52:06 +0200 Subject: [PATCH] Improve checking if tenant attribute is set --- src/Bootstrappers/LogTenancyBootstrapper.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Bootstrappers/LogTenancyBootstrapper.php b/src/Bootstrappers/LogTenancyBootstrapper.php index 05619bb0..6089500e 100644 --- a/src/Bootstrappers/LogTenancyBootstrapper.php +++ b/src/Bootstrappers/LogTenancyBootstrapper.php @@ -112,9 +112,11 @@ class LogTenancyBootstrapper implements TenancyBootstrapper // Map tenant properties to channel config keys. // If the tenant property is not set (= is null), // the override is ignored and the channel config key's value remains unchanged. - foreach ($override as $configKey => $tenantProperty) { - if ($tenant->$tenantProperty) { - $this->config->set("logging.channels.{$channel}.{$configKey}", $tenant->$tenantProperty); + foreach ($override as $configKey => $tenantAttributeName) { + $tenantAttribute = $tenant->getAttribute($tenantAttributeName); + + if ($tenantAttribute !== null) { + $this->config->set("logging.channels.{$channel}.{$configKey}", $tenantAttribute); } } } elseif ($override instanceof Closure) {