In Laravel 4, how do you use a table from another schema (other than the default schema defined in database.php) to query against?
The L4 docs do not show any sign of being able to do this...
In Laravel 4, how do you use a table from another schema (other than the default schema defined in database.php) to query against?
The L4 docs do not show any sign of being able to do this...
http://laravel.com/docs/database
define another schema config in the connections array
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
'newConnection' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
then just switch to it, per the docs:
$users = DB::connection('foo')->select(...);
$users = DB::connection('foo')->select(...); Does foo refers to either pgsql', mysql`, etc?