Laravel Multiple DB Connections in Laravel From Laravel Documentation


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();