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

Use data_get() instead of getAttribute() in overrideChannelConfig

The bootstrapper should be able to map nested tenant attributes to config, and `getAttribute()` doesn't support dot notation, so e.g. `$tenant->getAttribute('logging.slackUrl')` would return `null` instead of the actual attribute, so the test failed.

`data_get()` supports dot notation, so we'll use that.
This commit is contained in:
lukinovec 2026-06-29 15:37:14 +02:00
parent 8107ed4ecc
commit dc331bfd9b

View file

@ -171,7 +171,7 @@ class LogTenancyBootstrapper implements TenancyBootstrapper
// the override is ignored and the channel config key's value remains unchanged. // the override is ignored and the channel config key's value remains unchanged.
foreach ($override as $configKey => $tenantAttributeName) { foreach ($override as $configKey => $tenantAttributeName) {
/** @var Tenant&Model $tenant */ /** @var Tenant&Model $tenant */
$tenantAttribute = $tenant->getAttribute($tenantAttributeName); $tenantAttribute = data_get($tenant, $tenantAttributeName);
if ($tenantAttribute !== null) { if ($tenantAttribute !== null) {
$this->config->set("logging.channels.{$channel}.{$configKey}", $tenantAttribute); $this->config->set("logging.channels.{$channel}.{$configKey}", $tenantAttribute);