dimanche 30 août 2015

Changes in database configuration do not take effect

In laravel 5, I created Middleware that changes the database credentials:

config([ 'database.connections.mysql.database' => 'someDB', 'database.connections.mysql.username' => 'someUser', 'database.connections.mysql.password' => 'somePass' ]);

Using a route that makes use of the middleware, I tried to output the current database within the controller:

exit(config('database.connections.mysql.database'));

The information is correctly set to 'someDB'. When i use eloquent in the same function it tries to contact the 'old' database and not the 'someDB' settings I've set in the middleware.

Any thoughts about this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1X1QVnN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire