I am developing a multi database with common login laravel apps where user database is identified from a common table in default database.
After login it alters the default database setting to user defined database.
But it just goes to default database again in the next page request.
I alter the database as follows:
$config = \Config::get('database.connections.mysql');
$config['database'] = $check_db[0]->database_name;
config()->set('database.connections.mysql', $config);
DB::purge('mysql');
DB::reconnect('mysql');
Is there any other way to make it persistent through out the user session ?