I'm using Laravel 5.5 and MySQL, and I want to connect to multiple databases. I read many articles and most of them suggest to set
first, and in the controller use following code to connect to database:config/database.php
$result = DB::connection('mysql2')->select($);
It works for me, but I have multiple databases and have saved the host & port in the main database.
is it possible to query the database list and connection information from the database itself and then put it into the config/database.php
?
Or I should add the database list and connection information manually?