Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varible changes but when called it's getting the old value instead of the new one. #25

Open
erick-chali opened this issue Dec 14, 2016 · 1 comment

Comments

@erick-chali
Copy link

I follow the little guide on the README file
and tried to get the value by the method provided with the library

        $env = new DotenvEditor();
        $env->changeEnv(['VARIABLE'=>'new_value']);
        return $env->getValue('VARIABLE');

and by the default method.

        $env = new DotenvEditor();
        $env->changeEnv(['VARIABLE'=>'new_value']);
        return $env->getenv('VARIABLE');

but its not bringing the new value, instead it only recognizes the value if I restart the localhost server.
Any clue with this

@ankitkchetu
Copy link

You need to clear the config:cache after add or update .env variable. Add below code in add and update function of EnvController located at Brotzka\DotenvEditor\Http\Controllers location:

  1. include Facades config use Illuminate\Support\Facades\Config;
  2. public function add(Request $request)
    {
    $this->env->addData(
    [
    $request->key => $request->value,
    ]
    );
    Config::set($request->key, $request->value); // update config params need to add this code
    return response()->json([]);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants