I need to change laravel 5 database connection in run time.
Do you have any idea about it?
Please share with me.
Thanks.
You can change it like this since Laravel 5.x or 6.x
config(['database.default' => 'databasename']);
Where databasename has to be specified in config/database in the connections array.
databasename
config/database
connections