diff --git a/src/Illuminate/Foundation/Console/ConfigMakeCommand.php b/src/Illuminate/Foundation/Console/ConfigMakeCommand.php new file mode 100644 index 000000000000..644f9c2b5f4e --- /dev/null +++ b/src/Illuminate/Foundation/Console/ConfigMakeCommand.php @@ -0,0 +1,101 @@ +option('clear-config')) { + $this->call('config:clear'); + } + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return $this->resolveStubPath('/stubs/config.stub'); + } + + /** + * Resolve the fully-qualified path to the stub. + * + * @param string $stub + * @return string + */ + protected function resolveStubPath($stub) + { + return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) + ? $customPath + : __DIR__.$stub; + } + + /** + * Get the destination class path. + * + * @param string $name + * @return string + */ + protected function getPath($name) + { + return $this->laravel['path.config'].'/'.$this->argument('name').'.php'; + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getOptions() + { + return [ + ['clear-config', 'c', InputOption::VALUE_NONE, 'Clear the config cache after creating the config file.'], + ]; + } +} diff --git a/src/Illuminate/Foundation/Console/stubs/config.stub b/src/Illuminate/Foundation/Console/stubs/config.stub new file mode 100644 index 000000000000..badc965e69d7 --- /dev/null +++ b/src/Illuminate/Foundation/Console/stubs/config.stub @@ -0,0 +1,14 @@ + CastMakeCommand::class, 'ChannelMake' => ChannelMakeCommand::class, 'ComponentMake' => ComponentMakeCommand::class, + 'ConfigMake' => ConfigMakeCommand::class, 'ConsoleMake' => ConsoleMakeCommand::class, 'ControllerMake' => ControllerMakeCommand::class, 'Docs' => DocsCommand::class, @@ -340,6 +342,18 @@ protected function registerConfigClearCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerConfigMakeCommand() + { + $this->app->singleton(ConfigMakeCommand::class, function ($app) { + return new ConfigMakeCommand($app['files']); + }); + } + /** * Register the command. *