@leinad95 Check this Thread http://laravel.io/forum/03-02-2015-how-to-change-default-database-connection-in-controller
It might help you!
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello! I have an issue with a project I'm working on now and I need some help. I build an admin panel in laravel and for that I have a MySQL db setup and working. Now, I need for a specific model (but only when I config this) to use a different database. The problem is that I cannot set this up in config/database.php as a new connection because the database name is stored in my admin panel main database, in a table. How can I take that database name from my main admin's db and use the same credentials to make a model work with that specific database, but not interfering with the current db of the admin panel?
Thank You very much!
Please or to participate in this conversation.