Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

melvin@e-defix.nl's avatar

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?

0 likes
0 replies

Please or to participate in this conversation.