My application has to use two database connections, called mysql1 and mysql2. The User model is on the first connection and the Department model is on the second one.
There's a relationship between the two, a Department belongsToMany Users. The relationship uses the department_user pivot table that is stored on the mysql2 database.
This works great, except when it comes to testing. I'm using PHPUnit and setting the DB_DRIVER to sqlite and the DB_DATABASE to :memory: so that the test runs faster and don't hit the actual MySQL databases.
How can I make the in-memory databases work with multiple connections? Is there a way to give each of them a unique name?
The error the phpunit returns is table not found, meaning it is unable to connect second database.