src/Console/Commands/App/KeygenCommand.php
protected function writeNewEnvironmentFileWith($key)
    {
        file_put_contents(base_path('.env'), preg_replace(
            $this->keyReplacementPattern(),
            'APP_KEY='.$key,
            file_get_contents(base_path('.env'))
        ));
    }
protected function writeNewEnvironmentFileWith($key)
    {
        file_put_contents(base_path('.env'), preg_replace(
            $this->keyReplacementPattern(),
            'APP_KEY='.$key,
            file_get_contents(base_path('.env'))
        ));
    }
Write a new environment file with the given key.

@param  string  $key
@return void