My lumen application is connecting to multiple databases, one of my function need to connect to the database by URL parameter, is there any way to check the database already exists in my config/database.php
?
I've tried to use the function below :
$client = $request->input('client');
if (!$databse->setConnection($client)->getDatabaseName()) {
return 'no db';
}
but if the database not exists it will prompt error, even I can catch InvalidArgumentException
to display the error message, but is there any alternative way to do this? Thanks!