src/IndraGunawan/LaravelEnvHandler/Console/EnvUpdateCommand.php
public function fire()
    {
        $actualEnv = $this->loadDotEnv();
        $expectedEnv = $this->loadDotEnv(true);

        $realFile = rtrim(base_path(), '/').'/'.self::ENV;

        $action = empty($actualEnv) ? 'Creating' : 'Updating';
        $this->info(sprintf('%s the "%s" file', $action, self::ENV));

        $actualValue = $this->getEnvValue($expectedEnv, $actualEnv);

        //save the new env value to .env file if only has changed
        if (!empty($actualValue)) {
            file_put_contents($realFile, "# This file is auto-generated.\n".$actualValue);
        }

        // load back the new env
        $this->loadDotEnv();
    }
public function fire()
    {
        $actualEnv = $this->loadDotEnv();
        $expectedEnv = $this->loadDotEnv(true);

        $realFile = rtrim(base_path(), '/').'/'.self::ENV;

        $action = empty($actualEnv) ? 'Creating' : 'Updating';
        $this->info(sprintf('%s the "%s" file', $action, self::ENV));

        $actualValue = $this->getEnvValue($expectedEnv, $actualEnv);

        //save the new env value to .env file if only has changed
        if (!empty($actualValue)) {
            file_put_contents($realFile, "# This file is auto-generated.\n".$actualValue);
        }

        // load back the new env
        $this->loadDotEnv();
    }
Execute the console command.

@return void