読者です 読者をやめる 読者になる 読者になる

laravelでDBを2つつなぐ

    'connections' => [
        env('DB_CONNECTION_1') => [
            'driver'   => 'pgsql',
            'host'     => env('DB_HOST_1'),
            'database' => env('DB_DATABASE_1'),
            'username' => env('DB_USERNAME_1'),
            'password' => env('DB_PASSWORD_1'),
            'charset'  => 'utf8',
            'prefix'   => '',
            'schema'   => 'public',
        ],
        env('DB_CONNECTION_2') => [
            'driver'   => 'pgsql',
            'host'     => env('DB_HOST_2'),
            'database' => env('DB_DATABASE_2'),
            'username' => env('DB_USERNAME_2'),
            'password' => env('DB_PASSWORD_2'),
            'charset'  => 'utf8',
            'prefix'   => '',
            'schema'   => 'public',
        ],
    ],

 

.env

DB_CONNECTION_1=
DB_CONNECTION_2=