This is a Laravel 5 class that I have at the location app/Database/OTF.php
and use to connect to different databases on the fly.
// Using the same host/password/etc, just changing databases
$otf = new App\Database\OTF(['database' => 'kittens']);
// Get the users table
$users = $otf->getTable('users');
// Find the first user in the table
$first_user = $users->first();
Hi @lukevers
I had a need for something similar but then for the Lumen framework. You can find that code here:
https://gist.github.com/digitalkreativ/3eb197e39a5541f7c907b6cbdbfccb2d
I have of course linked to your blog and this gist in my gist :)