getRandomKey(); if ($this->option('show')) { return $this->line(''.$key.''); } $path = base_path('.env'); if (file_exists($path)) { file_put_contents( $path, str_replace(env('APP_KEY'), $key, file_get_contents($path)) ); } $this->info("Application key [$key] set successfully."); } /** * Generate a random key for the application. * * @return string */ protected function getRandomKey() { return Str::random(32); } /** * Get the console command options. * * @return array */ protected function getOptions() { return array( array('show', null, InputOption::VALUE_NONE, 'Simply display the key instead of modifying files.'), ); } }