code: protected function writeNewEnvironmentFileWith($key)
      {
          file_put_contents(base_path('.env'), preg_replace(
              $this->keyReplacementPattern(),
              'APP_KEY='.$key,
              file_get_contents(base_path('.env'))
          ));
      }
docs: Write a new environment file with the given key.
  
  @param  string  $key
  @return void