Mar 21, 2018
0
Level 5
Redis queues for multi tenancy
Hi,
I have a problem with redis queues for my multi-tenancy application.
The problem is that the job cannot select the database of the current tenant/user. I can set the database in the job itself like:
config()->set('database.connections.tenant.database', $tenant->databaseName);
config()->set('database.default', 'tenant');
DB::reconnect('tenant');
But the problem occurs when I can not add this to the job for example the job in the spatie medialibrary.
So is there a way that the queue uses the current Database Connection of the tenant/user?
Please or to participate in this conversation.