Create a new database config in /config/databases.php to use as the 2nd connection. You can leave some values blank, like username, password, database, etc.
'yourCustomConfig' => [
'host' => '196.168.1.2'
'driver' => 'mysql',
'database' => '',
'username' => '',
'password' => '',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
],
Then before you want to access it, you can change the values dynamically
Config::set("database.connections.yourCustomConfig", [
"host" => "1.2.3.4",
"database" => "differentDBName",
"username" => "Billy",
"password" => "Bob"
]);
Now any model using the 'yourCustomConfig' connection will use those values to connect for the duration of that request. You'd have to set it each time in between requests.
SomeModel::on('yourCustomConfig')->find(123);
or
DB::connection('yourCustomConfig')->table('someTable')->where('something', 'other')->get();