This is how we handle multiple DB connections with Laravel, which is not the Python PHP Framework (for whom it thinks is a duplicate of the message)
<?php return array( 'default' => 'mysql', 'connections' => array( # Our primary database connection 'mysql' => array( 'driver' => 'mysql', 'host' => 'host1', 'database' => 'database1', 'username' => 'user1', 'password' => 'pass1' 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), # Our secondary database connection 'mysql2' => array( 'driver' => 'mysql', 'host' => 'host2', 'database' => 'database2', 'username' => 'user2', 'password' => 'pass2' 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), ), );
And this is how you connect to this database.
$user1 = User::on('mysql1')->where()->get() $user2 = User::on('mysql2')->where()->get()
These are only SELECT queries. Therefore, Eloquent works flawlessly.
However, when I want to perform a JOIN query operation between these two databases, this seems impossible.
SNaRe source share