From 3aa391d9f835d72969081853acd8fcd2788d687c Mon Sep 17 00:00:00 2001 From: Gravitano Date: Sun, 17 May 2015 22:40:04 +0700 Subject: [PATCH] Added new 'module:make-request' console command. Fix pingpong-labs/modules#155 --- .../Modules/Commands/MakeRequestCommand.php | 71 +++++++++++++++++++ .../Modules/Commands/stubs/request.stub | 29 ++++++++ .../Providers/ConsoleServiceProvider.php | 1 + 3 files changed, 101 insertions(+) create mode 100644 src/Pingpong/Modules/Commands/MakeRequestCommand.php create mode 100644 src/Pingpong/Modules/Commands/stubs/request.stub diff --git a/src/Pingpong/Modules/Commands/MakeRequestCommand.php b/src/Pingpong/Modules/Commands/MakeRequestCommand.php new file mode 100644 index 00000000..722d1638 --- /dev/null +++ b/src/Pingpong/Modules/Commands/MakeRequestCommand.php @@ -0,0 +1,71 @@ + $this->getModuleName(), + 'NAME' => $this->getFileName(), + 'MODULE_NAMESPACE' => $this->laravel['modules']->config('namespace') + ]))->render(); + } + + /** + * @return mixed + */ + protected function getDestinationFilePath() + { + $path = $this->laravel['modules']->getModulePath($this->getModuleName()); + + $seederPath = $this->laravel['modules']->config('paths.generator.request'); + + return $path . $seederPath . '/' . $this->getFileName() . '.php'; + } + + /** + * @return string + */ + private function getFileName() + { + return Str::studly($this->argument('name')); + } + +} diff --git a/src/Pingpong/Modules/Commands/stubs/request.stub b/src/Pingpong/Modules/Commands/stubs/request.stub new file mode 100644 index 00000000..8eb12610 --- /dev/null +++ b/src/Pingpong/Modules/Commands/stubs/request.stub @@ -0,0 +1,29 @@ +