'Laravel site cant be reached for this DotenvEditor

I am uses Dotenveditor to save the env parameters but after redirecting i faced error as

This site can’t be reachedThe connection was reset. Try:

Checking the connection Checking the proxy and the firewall ERR_CONNECTION_RESET

what is mistake in my code? rest part of controller works properly.

if (isset($request->APP_DEBUG)) {
            $env_update = DotenvEditor::setKeys(['APP_DEBUG' => 'true']);
        } else {
            $env_update = DotenvEditor::setKeys(['APP_DEBUG' => 'false']);
        }
        if (isset($request->COOKIE_CONSENT_ENABLED)) {
            $env_update = DotenvEditor::setKeys(['COOKIE_CONSENT_ENABLED' => 'true']);
        } else {
            $env_update = DotenvEditor::setKeys(['COOKIE_CONSENT_ENABLED' => 'false']);
        }

        $env_update = DotenvEditor::setKeys([
            'APP_NAME' => preg_replace('/\s+/', '', $request->title),
            'APP_URL' => preg_replace('/\s+/', '', $request->APP_URL),
        ]);

        $env_update->save();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source