With great powers comes great responsibility, changing .env values in the server
were great but if you don't have access to it this code might come in handy.
In your route, where key is the key, and value will be the new env value
In your route, where key is the key, and value will be the new env value
Route::get('changeenv/{key?}/{value?}',"controller@methodname");
In your controller
public function changeEnv($key, $value)
{
$path = app()->environmentFilePath();
$escaped = preg_quote('=' . env($key), '/');
file_put_contents($path, preg_replace(
"/^{$key}{$escaped}/m",
"{$key}={$value}",
file_get_contents($path)
));
return "env change successfully " . env($key);
}
In your browser, you could type this to change the .env's CAPTCHA value
https://mysite.com/changeenv/CAPTCHA/new_value