From ab9fc26108cdd6d71535c463b273bfaa74f92c8c 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 --- Commands/MakeRequestCommand.php | 71 ++++++++++++++++++++++++++++ Commands/stubs/request.stub | 29 ++++++++++++ Providers/ConsoleServiceProvider.php | 1 + 3 files changed, 101 insertions(+) create mode 100644 Commands/MakeRequestCommand.php create mode 100644 Commands/stubs/request.stub diff --git a/Commands/MakeRequestCommand.php b/Commands/MakeRequestCommand.php new file mode 100644 index 0000000..722d163 --- /dev/null +++ b/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/Commands/stubs/request.stub b/Commands/stubs/request.stub new file mode 100644 index 0000000..8eb1261 --- /dev/null +++ b/Commands/stubs/request.stub @@ -0,0 +1,29 @@ +