Closed Bibendus83 closed 4 years ago
I noticed there is another open ticket about this #751
Let's close this and just track it under #751
As a side note, for future reference, I was able to make the library qcod/laravel-app-settings
work with jobs flawlessly.
First I noticed I had a issue with caching, even if each tenant has its settings table I had to define a different cache key for each one specifying a cache tenant identifier in app_settings.php
'setting_group' => function() {
$website = app(\Hyn\Tenancy\Environment::class)->tenant();
if (!$website) {
throw new \Exception("Tenant not set while trying to read app setting value");
}
return "tenant-".$website->id;
}
As a second thing, considering the library model Setting.php
can't be extended to add the UsesTenantConnection
trait, I was able to extend it anyway with some work.
I disabled laravel auto discovery and added my custom SettingsServiceProvider
class in app.php
.
Following the chain of classess I was able then to force the use of my custom Setting.php
model class where I addedd the UsesTenantConnection
trait.
Description
I tried using the setting
force-tenant-connection-of-models
intenancy.php
to force the tenant connection on an external libraryModel
but the setting is ignored.The library I'm using using is
qcod/laravel-app-settings
and I'm using it to easily implement custom settings for each tenant. When I try to use it I get this error:Information
tenancy.php config
webserver.php config
.env file