$capsule = new Capsule;
$capsule->addConnection(
array(
'driver' => 'mysql',
'host' => "localhost",
'database' => "employees_db",
'username' => "root",
'password' => "",
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
"default"
);
$capsule->addConnection(
array(
'driver' => 'mysql',
'host' => "192.168.1.8",
'database' => "ihris",
'username' => "christian",
'password' => "Thedarkknight1!",
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
"employees"
);
$capsule->setAsGlobal();
$capsule->bootEloquent();
reference : http://stackoverflow.com/questions/34649181/multiple-database-connection-using-illuminate-database-eloquent-orm-in-codeignit
沒有留言:
張貼留言