How can I join 2 tables which are located on 2 different servers.
I setup db configs:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
'options' => [
\PDO::ATTR_EMULATE_PREPARES => true
]
],
'mysql2' => [
'driver' => 'mysql',
'host' => '132.133.22.9',
'port' => '3306',
'database' => 'contracts',
'username' => 'asdsdsa',
'password' => 'asdsad',
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
'options' => [
\PDO::ATTR_EMULATE_PREPARES => true
]
],
I'm able to access only one like DB::connection('mysql')->table('elements')->get();
How can I use leftJoin for two tables on two different servers?
lets say I have:
elements (server1): id, class_id
classes (server2) id, name
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire