Running queries against a database connection is a breeze using the query method on the DB class:
$users = DB::query('select * from users');
The query method also allows you to specify bindings for your query in the second parameter to the method:
$users = DB::query('select * from users where name = ?', array('test'));
The return value of the query method depends on the type of query that is executed:
Need to get the raw PDO object for a connection? It's easy. Just mention the connection name to the connection method on the DB class:
$pdo = DB::connection('sqlite');
Note: If no connection name is specified, the default connection will be returned.
Want to know which PDO driver is being used for a connection? Check out the driver method:
$driver = DB::driver('connection_name');
Note: If no connection name is specified, the default connection driver will be returned.