Laravel Multiple DB Connections in Laravel From Laravel Documentation


Example

Each individual connection can be accessed via the connection method on the DB facade, even when there are multiple connections defined. The name passed to the connection method should correspond to one of the connections listed in the config/database.php configuration file:

$users = DB::connection('foo')->select(...);

The raw can also be accessed, underlying PDO instance using the getPdo method on a connection instance:

$pdo = DB::connection()->getPdo();

https://laravel.com/docs/5.4/database#using-multiple-database-connections