Let's say, i've defined
DB_DATABASE=one
but, there is a time i want to change database name connection using code below
putenv("DB_DATABASE=two");
the env changing but it seems that the connection doesn't change. Can someone explain this ?
Thanks
Because Laravel loads configuration once on the bootstrap.
You can change a behavior of the app loaders, but there are easier ways to change db connection in Controller.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community