Multiple Database Connection
If your application needs to interact with multiple DB you can define all the required DB details in app/config/database.php file. Adding another config file is not recommended.
'connections' => array(
'mysql1' => array( // mysql1 -> connection_name
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'example',
'username' => 'example',
'password' => 'example',
..
),
'mysql2' => array( // mysql2 -> connection_name
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'example2',
'username' => 'example2',
'password' => 'example2',
..
),
),
When writing queries you can connect to the required DB likewise:
If Query Builder
$users = DB::connection('connection_name')->select(...);
Eloquent
Within the model:
class User extends Eloquent {
protected $connection = 'connection_name';
}
When trying to fetch values use as follows
$userModel = new User();
$userModel->setConnection('connection_name');
$result = $userModel->newQuery()->find(1);
Laravel doc
Hope this would get you started.