Hi everyone.
I have a problem that i am trying to solve like 1 week for now, I don't know what can I do more so I am going to explain you every detail of my problem.
So I have a system that have a main login:
Company
E-mail
Password
When the login is successful, it redirects do crudbooster with the selected company database choosed on the login. My problem is that I can't change the database when it redirects do crudbooster, it looks like crudbooster is only reading .env file and ignoring all the code that I added to change database config.
config()->set('database.connections.tenant.host', $company->bd_hostname);
config()->set('database.connections.tenant.database', $company->bd_database);
config()->set('database.connections.tenant.username', $company->bd_username);
config()->set('database.connections.tenant.password', $company->bd_password);
DB::reconnect('tenant');
Schema::connection('tenant')->getConnection()->reconnect();`
This is the code I add to change the database connection, it really works at the login page, I tried some dd(DB::getDatabaseName()) and it really changes by the company selected on the login.
The problem is when the user enters the crudbooster main screen, after login, it looks like crudbooster is ignoring every configuration set before and only reads .env file.
I really need help with this if someone can help me.
Thank you so much.