code: protected function setKeyInEnvironmentFile($key, $input, $output)
      {
          $currentKey = config('app.key');
  
          $helper = $this->getHelper('question');
          $question = new ConfirmationQuestion('Application key will re-generate. Are you sure?: ', false);
          if (strlen($currentKey) !== 0 && (! $helper->ask($input, $output, $question))) {
              return false;
          }
  
          $this->writeNewEnvironmentFileWith($key);
          return true;
      }
docs: Set the application key in the environment file.
  
  @param  string  $key
  @return bool