Laravel - Getting Started - Using Multiple Database Connections
If your application defines multiple connections in your config/database.php
configuration file, you may access each connection via the connection
method provided by the DB
facade. The connection name passed to the connection
method should correspond to one of the connections listed in your config/database.php
configuration file or configured at runtime using the config
helper:
use Illuminate\Support\Facades\DB;
$users = DB::connection('sqlite')->select(...);
You may access the raw, underlying PDO instance of a connection using the getPdo
method on a connection instance:
$pdo = DB::connection()->getPdo();