Created
July 8, 2014 11:19
-
-
Save descubraomundo/7219d996b46993f1e1ca to your computer and use it in GitHub Desktop.
Laravel Override Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get config loader | |
$loader = $this->app['config']->getLoader(); | |
// Get environment name | |
$env = $this->app['config']->getEnvironment(); | |
// Add package namespace with path set base on your requirement | |
$loader->addNamespace('basset',__DIR__.'/../config/basset'); | |
// Load package override config file | |
$configs = $loader->load($env,'config','basset'); | |
// Override value | |
$this->app['config']->set('basset::config',$configs); |
shouldn't config()->set('file.key', 'value');
work?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @descubraomundo, where do you think is better place to put this code? On
bootstrap/app.php
for onpublic/index.php
? I was searching for environment specific configuration too. Will this work for Laravel 5.6?