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

bitsense's avatar

nova multitenancy: how to change dinamically database name

Hi!

In nova i'm trying to change the database name of the default connection according to multiple domains. I've registered in nova config a custom middleware (wich is working outside nova) to set up the database name in the default connection. Nova is executing the middleware and the connection is correctly changed but nova continue to use the default connection database defined in the .env Am I missing something?

Thanks! Luca

0 likes
3 replies
SheldonCooper1's avatar

If my eloquent models are in app/Models, should my policies be located in app/Policies or app/Models/Policies? It seems like for Policy Auto-Discovery, I should place them in app/Models/Policies. Any time I use artisan's make:policy it will place https://testmyspeed.onl/ https://essaywriter.fun/ the new policy in app/Policies. Is there any way to get artisan to change the directory it places the policy in? Thanks for any pointers.

bitsense's avatar

Hi! i'm not understanding the answer, wrong thread maybe? :)

bitsense's avatar

Solved! :) I had to register my middleware at first and not at last in nova.php config file :)

Please or to participate in this conversation.