dip1232001 dip1232001 - 6 months ago 59
PHP Question

Laravel How to overload environment values dynamically

Is there any way , to overload few environment variables dynamically, i tried to overload in controller constructor which works fine , but in some cases when variables are loaded via config/services.php it does not seems to get the values which i overloaded in the controller, i suspect that the sevices.php is being called prior to controller constructor method, is there any valid way to load them dynamically on start of the app .

Don't want to do it via file instead run time.


To set configuration values at runtime, pass an array to the config helper:

config(['app.timezone' => 'America/Chicago']);