You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! We have a multitenancy app which runs a backup every day. After updating from v8 to v9 we remarked that config is always loaded from config.php file from disk. This way we can't configure dynamically the config options according to each tenant. This is our code for changing the config dynamically which is working in v8, but not in v9:
<?php
namespace App\Tasks;
use Spatie\Multitenancy\Contracts\IsTenant;
use Spatie\Multitenancy\Tasks\SwitchTenantTask;
class SwitchBackupDatabaseTask implements SwitchTenantTask
{
public function __construct(protected ?array $originalBackupDatabase = null, protected ?string $originalBackupFilenamePrefix = null)
{
$this->originalBackupDatabase ??= config('backup.backup.source.databases');
$this->originalBackupFilenamePrefix ??= config('backup.backup.destination.filename_prefix');
}
public function makeCurrent(IsTenant $tenant): void
{
config()->set('backup.backup.source.databases', ['tenant']);
config()->set('backup.backup.destination.filename_prefix', $tenant->database . '-');
}
public function forgetCurrent(): void
{
config()->set('backup.backup.source.databases', $this->originalBackupDatabase);
config()->set('backup.backup.destination.filename_prefix', $this->originalBackupFilenamePrefix);
}
}
The text was updated successfully, but these errors were encountered:
Hi! We have a multitenancy app which runs a backup every day. After updating from v8 to v9 we remarked that config is always loaded from config.php file from disk. This way we can't configure dynamically the config options according to each tenant. This is our code for changing the config dynamically which is working in v8, but not in v9:
The text was updated successfully, but these errors were encountered: