From 604a206ce6276f8b42bfaddf0077e2e511a5f5c7 Mon Sep 17 00:00:00 2001 From: Frank Lakatos Date: Tue, 4 Feb 2020 21:47:13 -0500 Subject: [PATCH 1/2] Add make:config command --- .../Foundation/Console/ConfigMakeCommand.php | 41 +++++++++++++++++++ .../Foundation/Console/stubs/config.stub | 5 +++ .../Providers/ArtisanServiceProvider.php | 14 +++++++ 3 files changed, 60 insertions(+) create mode 100644 src/Illuminate/Foundation/Console/ConfigMakeCommand.php create mode 100644 src/Illuminate/Foundation/Console/stubs/config.stub diff --git a/src/Illuminate/Foundation/Console/ConfigMakeCommand.php b/src/Illuminate/Foundation/Console/ConfigMakeCommand.php new file mode 100644 index 000000000000..58b3d55d2913 --- /dev/null +++ b/src/Illuminate/Foundation/Console/ConfigMakeCommand.php @@ -0,0 +1,41 @@ +getNameInput() . '.php'; + $stub = $this->files->get($this->getStub()); + + $this->files->put($path, $stub); + $this->info($this->getNameInput() .' config created successfully.'); + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + return __DIR__.'/stubs/config.stub'; + } +} \ No newline at end of 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..3ac44ad10138 --- /dev/null +++ b/src/Illuminate/Foundation/Console/stubs/config.stub @@ -0,0 +1,5 @@ + 'command.cache.table', 'ChannelMake' => 'command.channel.make', + 'ConfigMake' => 'command.config.make', 'ConsoleMake' => 'command.console.make', 'ControllerMake' => 'command.controller.make', 'EventGenerate' => 'command.event.generate', @@ -270,6 +272,18 @@ protected function registerConfigClearCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerConfigMakeCommand() + { + $this->app->singleton('command.config.make', function ($app) { + return new ConfigMakeCommand($app['files']); + }); + } + /** * Register the command. * From c16ce856ca49274f8424a37a3e3ac2f6fbdde6b7 Mon Sep 17 00:00:00 2001 From: Frank Lakatos Date: Tue, 4 Feb 2020 22:00:59 -0500 Subject: [PATCH 2/2] Applied StyleCI diff --- src/Illuminate/Foundation/Console/ConfigMakeCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Foundation/Console/ConfigMakeCommand.php b/src/Illuminate/Foundation/Console/ConfigMakeCommand.php index 58b3d55d2913..ecd336308586 100644 --- a/src/Illuminate/Foundation/Console/ConfigMakeCommand.php +++ b/src/Illuminate/Foundation/Console/ConfigMakeCommand.php @@ -20,13 +20,13 @@ class ConfigMakeCommand extends GeneratorCommand */ protected $description = 'Create a new config file'; - public function handle () + public function handle() { - $path = config_path() . '/' . $this->getNameInput() . '.php'; + $path = config_path().'/'.$this->getNameInput().'.php'; $stub = $this->files->get($this->getStub()); $this->files->put($path, $stub); - $this->info($this->getNameInput() .' config created successfully.'); + $this->info($this->getNameInput().' config created successfully.'); } /** @@ -38,4 +38,4 @@ protected function getStub() { return __DIR__.'/stubs/config.stub'; } -} \ No newline at end of file +}