Select,update insert specific tables from another database. In cakephp 3

I know.

There are some questions in here which had this already. But in my case it’s somehow different:

I have to databases. 1. Database (as default) which has User login data. When user come loggin.
He will take this default database configuert in app.php.

The name of the 2. db I get from user-data. I can connect by defining a new db connection to the 2. database.

What is the best way to setup each model table so it will take datas from the 2. db??

public static function defaultConnectionName() {
    return 'customer';
}

expected customer has been fixed setup in app.php! So this can’t be the way…

Hi,

Did you check this answer on this related post on stackoverflow:

Multiple database connection in cakephp 3

And maybe have look here as well:

connect-with-multiple-database-in-cakephp-3