From 3280cc61f14c2a15ec00ae580e582be2d874ba40 Mon Sep 17 00:00:00 2001 From: iMokhles Date: Sun, 28 Feb 2021 11:15:25 +0100 Subject: [PATCH 1/7] added support for subfolder directory --- src/Console/Commands/CrudBackpackCommand.php | 17 +++++++++----- .../CrudControllerBackpackCommand.php | 22 +++++++++++++++---- .../Commands/CrudModelBackpackCommand.php | 7 ++++-- .../Commands/CrudRequestBackpackCommand.php | 14 ++++++++++-- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/src/Console/Commands/CrudBackpackCommand.php b/src/Console/Commands/CrudBackpackCommand.php index f3beee3..5a3c2bd 100644 --- a/src/Console/Commands/CrudBackpackCommand.php +++ b/src/Console/Commands/CrudBackpackCommand.php @@ -12,7 +12,7 @@ class CrudBackpackCommand extends Command * * @var string */ - protected $signature = 'backpack:crud {name}'; + protected $signature = 'backpack:crud {name} {folder?}'; /** * The console command description. @@ -32,18 +32,25 @@ public function handle() $lowerName = strtolower($this->argument('name')); $pluralName = Str::plural($name); + $argumentsArray = ['name' => $name]; + $crudControllerName = "{$name}CrudController"; + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + $argumentsArray['folder'] = $folderName; + $crudControllerName = "$folderName\{$name}CrudController"; + } // Create the CRUD Controller and show output - $this->call('backpack:crud-controller', ['name' => $name]); + $this->call('backpack:crud-controller', $argumentsArray); // Create the CRUD Model and show output - $this->call('backpack:crud-model', ['name' => $name]); + $this->call('backpack:crud-model', $argumentsArray); // Create the CRUD Request and show output - $this->call('backpack:crud-request', ['name' => $name]); + $this->call('backpack:crud-request', $argumentsArray); // Create the CRUD route $this->call('backpack:add-custom-route', [ - 'code' => "Route::crud('$lowerName', '{$name}CrudController');", + 'code' => "Route::crud('$lowerName', '$crudControllerName');", ]); // Create the sidebar item diff --git a/src/Console/Commands/CrudControllerBackpackCommand.php b/src/Console/Commands/CrudControllerBackpackCommand.php index 3151462..34258c6 100644 --- a/src/Console/Commands/CrudControllerBackpackCommand.php +++ b/src/Console/Commands/CrudControllerBackpackCommand.php @@ -20,7 +20,7 @@ class CrudControllerBackpackCommand extends GeneratorCommand * * @var string */ - protected $signature = 'backpack:crud-controller {name}'; + protected $signature = 'backpack:crud-controller {name} {folder?}'; /** * The console command description. @@ -46,8 +46,12 @@ class CrudControllerBackpackCommand extends GeneratorCommand protected function getPath($name) { $name = str_replace($this->laravel->getNamespace(), '', $name); - - return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; + $path = $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + $path = $this->laravel['path'].'/'.$folderName.'/'.str_replace('\\', '/', $name).'CrudController.php'; + } + return $path; } /** @@ -69,7 +73,13 @@ protected function getStub() */ protected function getDefaultNamespace($rootNamespace) { - return $rootNamespace.'\Http\Controllers\Admin'; + $currentNamespace = $rootNamespace.'\Http\Controllers\Admin'; + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + $currentNamespace = $rootNamespace.'\Http\Controllers\Admin\\'.$folderName; + + } + return $currentNamespace; } /** @@ -118,6 +128,10 @@ protected function replaceSetFromDb(&$stub, $name) { $class = Str::afterLast($name, '\\'); $model = "App\\Models\\$class"; + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + $model = "App\\Models\\".$folderName."\\$class"; + } if (! class_exists($model)) { return $this; diff --git a/src/Console/Commands/CrudModelBackpackCommand.php b/src/Console/Commands/CrudModelBackpackCommand.php index cbb81a6..f576da5 100644 --- a/src/Console/Commands/CrudModelBackpackCommand.php +++ b/src/Console/Commands/CrudModelBackpackCommand.php @@ -19,7 +19,7 @@ class CrudModelBackpackCommand extends GeneratorCommand * * @var string */ - protected $signature = 'backpack:crud-model {name}'; + protected $signature = 'backpack:crud-model {name} {folder?}'; /** * The console command description. @@ -54,7 +54,10 @@ public function handle() $name = $this->getNameInput(); $namespaceApp = $this->qualifyClass($this->getNameInput()); $namespaceModels = $this->qualifyClass('/Models/'.$this->getNameInput()); - + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + $namespaceModels = $this->qualifyClass('/Models/'.$folderName.'/'.$this->getNameInput()); + } // Check if exists on app or models $existsOnApp = $this->alreadyExists($namespaceApp); $existsOnModels = $this->alreadyExists($namespaceModels); diff --git a/src/Console/Commands/CrudRequestBackpackCommand.php b/src/Console/Commands/CrudRequestBackpackCommand.php index 4f345e6..c594403 100644 --- a/src/Console/Commands/CrudRequestBackpackCommand.php +++ b/src/Console/Commands/CrudRequestBackpackCommand.php @@ -18,7 +18,7 @@ class CrudRequestBackpackCommand extends GeneratorCommand * * @var string */ - protected $signature = 'backpack:crud-request {name}'; + protected $signature = 'backpack:crud-request {name} {folder?}'; /** * The console command description. @@ -44,7 +44,11 @@ class CrudRequestBackpackCommand extends GeneratorCommand protected function getPath($name) { $name = str_replace($this->laravel->getNamespace(), '', $name); - + $path = $this->laravel['path'].'/'.str_replace('\\', '/', $name).'Request.php'; + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + $path = $this->laravel['path'].'/'.$folderName.'/'.str_replace('\\', '/', $name).'Request.php'; + } return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'Request.php'; } @@ -67,6 +71,12 @@ protected function getStub() */ protected function getDefaultNamespace($rootNamespace) { + $currentNamespace = $rootNamespace.'\Http\Requests'; + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + $currentNamespace =$rootNamespace.'\Http\Requests\\'.$folderName; + + } return $rootNamespace.'\Http\Requests'; } From e314a58827afb0b8feef77ffea1bb05ce2fe0587 Mon Sep 17 00:00:00 2001 From: iMokhles Date: Sun, 28 Feb 2021 11:27:35 +0100 Subject: [PATCH 2/7] fixed controller path --- src/Console/Commands/CrudControllerBackpackCommand.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Console/Commands/CrudControllerBackpackCommand.php b/src/Console/Commands/CrudControllerBackpackCommand.php index 34258c6..0290102 100644 --- a/src/Console/Commands/CrudControllerBackpackCommand.php +++ b/src/Console/Commands/CrudControllerBackpackCommand.php @@ -46,12 +46,7 @@ class CrudControllerBackpackCommand extends GeneratorCommand protected function getPath($name) { $name = str_replace($this->laravel->getNamespace(), '', $name); - $path = $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; - if ($this->hasArgument('folder')) { - $folderName = ucfirst($this->argument('folder')); - $path = $this->laravel['path'].'/'.$folderName.'/'.str_replace('\\', '/', $name).'CrudController.php'; - } - return $path; + return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'CrudController.php'; } /** From 4e1b214b58c349e70d64c6ae2ddb0698a597d62c Mon Sep 17 00:00:00 2001 From: iMokhles Date: Sun, 28 Feb 2021 12:13:59 +0100 Subject: [PATCH 3/7] added improvements and fixes --- src/Console/Commands/CrudBackpackCommand.php | 2 +- .../CrudControllerBackpackCommand.php | 22 +++++++++++++++---- .../Commands/CrudModelBackpackCommand.php | 7 ++++-- .../Commands/CrudRequestBackpackCommand.php | 7 +----- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/Console/Commands/CrudBackpackCommand.php b/src/Console/Commands/CrudBackpackCommand.php index 5a3c2bd..21a0a5e 100644 --- a/src/Console/Commands/CrudBackpackCommand.php +++ b/src/Console/Commands/CrudBackpackCommand.php @@ -37,7 +37,7 @@ public function handle() if ($this->hasArgument('folder')) { $folderName = ucfirst($this->argument('folder')); $argumentsArray['folder'] = $folderName; - $crudControllerName = "$folderName\{$name}CrudController"; + $crudControllerName = "$folderName\\".$name."CrudController"; } // Create the CRUD Controller and show output $this->call('backpack:crud-controller', $argumentsArray); diff --git a/src/Console/Commands/CrudControllerBackpackCommand.php b/src/Console/Commands/CrudControllerBackpackCommand.php index 0290102..6e835fc 100644 --- a/src/Console/Commands/CrudControllerBackpackCommand.php +++ b/src/Console/Commands/CrudControllerBackpackCommand.php @@ -168,7 +168,21 @@ protected function replaceSetFromDb(&$stub, $name) protected function replaceModel(&$stub, $name) { $class = str_replace($this->getNamespace($name).'\\', '', $name); - $stub = str_replace(['DummyClass', '{{ class }}', '{{class}}'], $class, $stub); + if ($this->hasArgument('folder')) { + $folderName = ucfirst($this->argument('folder')); + + // replace crudcontroller + $stub = str_replace('DummyClassCrudController', $class.'CrudController', $stub); + + // replace CrudRequest + $stub = str_replace('\DummyClassRequest', "\\".$folderName.'\\'.$class.'Request', $stub); + + // replace CrudModel + $stub = str_replace('DummyClass::class', $folderName.'\\'.$class.'::class', $stub); + + } else { + $stub = str_replace(['DummyClass', '{{ class }}', '{{class}}'], $class, $stub); + } return $this; } @@ -185,9 +199,9 @@ protected function buildClass($name) $stub = $this->files->get($this->getStub()); $this->replaceNamespace($stub, $name) - ->replaceNameStrings($stub, $name) - ->replaceModel($stub, $name) - ->replaceSetFromDb($stub, $name); + ->replaceNameStrings($stub, $name) + ->replaceModel($stub, $name) + ->replaceSetFromDb($stub, $name); return $stub; } diff --git a/src/Console/Commands/CrudModelBackpackCommand.php b/src/Console/Commands/CrudModelBackpackCommand.php index f576da5..e2bdaaa 100644 --- a/src/Console/Commands/CrudModelBackpackCommand.php +++ b/src/Console/Commands/CrudModelBackpackCommand.php @@ -66,7 +66,11 @@ public function handle() // should be written. Then, we will build the class and make the proper replacements on // the stub files so that it gets the correctly formatted namespace and class name. if (! $existsOnApp && ! $existsOnModels) { - $this->makeDirectory($namespaceModels); + if ($this->hasArgument('folder')) { + mkdir(str_replace('/'.$this->getNameInput().'.php', '', $this->getPath($namespaceModels))); + } else { + $this->makeDirectory($namespaceModels); + } $this->files->put($this->getPath($namespaceModels), $this->sortImports($this->buildClass($namespaceModels))); @@ -176,7 +180,6 @@ protected function replaceTable(&$stub, $name) protected function buildClass($name) { $stub = $this->files->get($this->getStub()); - return $this->replaceNamespace($stub, $name)->replaceTable($stub, $name)->replaceClass($stub, $name); } diff --git a/src/Console/Commands/CrudRequestBackpackCommand.php b/src/Console/Commands/CrudRequestBackpackCommand.php index c594403..27e0149 100644 --- a/src/Console/Commands/CrudRequestBackpackCommand.php +++ b/src/Console/Commands/CrudRequestBackpackCommand.php @@ -44,11 +44,6 @@ class CrudRequestBackpackCommand extends GeneratorCommand protected function getPath($name) { $name = str_replace($this->laravel->getNamespace(), '', $name); - $path = $this->laravel['path'].'/'.str_replace('\\', '/', $name).'Request.php'; - if ($this->hasArgument('folder')) { - $folderName = ucfirst($this->argument('folder')); - $path = $this->laravel['path'].'/'.$folderName.'/'.str_replace('\\', '/', $name).'Request.php'; - } return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'Request.php'; } @@ -77,7 +72,7 @@ protected function getDefaultNamespace($rootNamespace) $currentNamespace =$rootNamespace.'\Http\Requests\\'.$folderName; } - return $rootNamespace.'\Http\Requests'; + return $currentNamespace; } /** From 1c3f9901bfa6b1d2c69f116e452dcd346c1e8d88 Mon Sep 17 00:00:00 2001 From: iMokhles Date: Sun, 28 Feb 2021 14:46:59 +0100 Subject: [PATCH 4/7] fixed folder argument present check --- src/Console/Commands/CrudBackpackCommand.php | 2 +- src/Console/Commands/CrudControllerBackpackCommand.php | 6 +++--- src/Console/Commands/CrudModelBackpackCommand.php | 4 ++-- src/Console/Commands/CrudRequestBackpackCommand.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Console/Commands/CrudBackpackCommand.php b/src/Console/Commands/CrudBackpackCommand.php index 21a0a5e..08d637a 100644 --- a/src/Console/Commands/CrudBackpackCommand.php +++ b/src/Console/Commands/CrudBackpackCommand.php @@ -34,7 +34,7 @@ public function handle() $argumentsArray = ['name' => $name]; $crudControllerName = "{$name}CrudController"; - if ($this->hasArgument('folder')) { + if (strlen($this->argument('folder')) > 1) { $folderName = ucfirst($this->argument('folder')); $argumentsArray['folder'] = $folderName; $crudControllerName = "$folderName\\".$name."CrudController"; diff --git a/src/Console/Commands/CrudControllerBackpackCommand.php b/src/Console/Commands/CrudControllerBackpackCommand.php index 6e835fc..c11d0ea 100644 --- a/src/Console/Commands/CrudControllerBackpackCommand.php +++ b/src/Console/Commands/CrudControllerBackpackCommand.php @@ -69,7 +69,7 @@ protected function getStub() protected function getDefaultNamespace($rootNamespace) { $currentNamespace = $rootNamespace.'\Http\Controllers\Admin'; - if ($this->hasArgument('folder')) { + if (strlen($this->argument('folder')) > 1) { $folderName = ucfirst($this->argument('folder')); $currentNamespace = $rootNamespace.'\Http\Controllers\Admin\\'.$folderName; @@ -123,7 +123,7 @@ protected function replaceSetFromDb(&$stub, $name) { $class = Str::afterLast($name, '\\'); $model = "App\\Models\\$class"; - if ($this->hasArgument('folder')) { + if (strlen($this->argument('folder')) > 1) { $folderName = ucfirst($this->argument('folder')); $model = "App\\Models\\".$folderName."\\$class"; } @@ -168,7 +168,7 @@ protected function replaceSetFromDb(&$stub, $name) protected function replaceModel(&$stub, $name) { $class = str_replace($this->getNamespace($name).'\\', '', $name); - if ($this->hasArgument('folder')) { + if (strlen($this->argument('folder')) > 1) { $folderName = ucfirst($this->argument('folder')); // replace crudcontroller diff --git a/src/Console/Commands/CrudModelBackpackCommand.php b/src/Console/Commands/CrudModelBackpackCommand.php index e2bdaaa..b1593d2 100644 --- a/src/Console/Commands/CrudModelBackpackCommand.php +++ b/src/Console/Commands/CrudModelBackpackCommand.php @@ -54,7 +54,7 @@ public function handle() $name = $this->getNameInput(); $namespaceApp = $this->qualifyClass($this->getNameInput()); $namespaceModels = $this->qualifyClass('/Models/'.$this->getNameInput()); - if ($this->hasArgument('folder')) { + if (strlen($this->argument('folder')) > 1) { $folderName = ucfirst($this->argument('folder')); $namespaceModels = $this->qualifyClass('/Models/'.$folderName.'/'.$this->getNameInput()); } @@ -66,7 +66,7 @@ public function handle() // should be written. Then, we will build the class and make the proper replacements on // the stub files so that it gets the correctly formatted namespace and class name. if (! $existsOnApp && ! $existsOnModels) { - if ($this->hasArgument('folder')) { + if (strlen($this->argument('folder')) > 1) { mkdir(str_replace('/'.$this->getNameInput().'.php', '', $this->getPath($namespaceModels))); } else { $this->makeDirectory($namespaceModels); diff --git a/src/Console/Commands/CrudRequestBackpackCommand.php b/src/Console/Commands/CrudRequestBackpackCommand.php index 27e0149..7016af7 100644 --- a/src/Console/Commands/CrudRequestBackpackCommand.php +++ b/src/Console/Commands/CrudRequestBackpackCommand.php @@ -67,7 +67,7 @@ protected function getStub() protected function getDefaultNamespace($rootNamespace) { $currentNamespace = $rootNamespace.'\Http\Requests'; - if ($this->hasArgument('folder')) { + if (strlen($this->argument('folder')) > 1) { $folderName = ucfirst($this->argument('folder')); $currentNamespace =$rootNamespace.'\Http\Requests\\'.$folderName; From db1f44f61d9186f519bfb297105e24ae0245cf51 Mon Sep 17 00:00:00 2001 From: iMokhles Date: Sun, 28 Feb 2021 14:55:10 +0100 Subject: [PATCH 5/7] added new option to include folder name to routes --- src/Console/Commands/CrudBackpackCommand.php | 43 ++++++++++++++----- .../CrudControllerBackpackCommand.php | 8 +++- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/Console/Commands/CrudBackpackCommand.php b/src/Console/Commands/CrudBackpackCommand.php index 08d637a..ac91ef3 100644 --- a/src/Console/Commands/CrudBackpackCommand.php +++ b/src/Console/Commands/CrudBackpackCommand.php @@ -12,7 +12,7 @@ class CrudBackpackCommand extends Command * * @var string */ - protected $signature = 'backpack:crud {name} {folder?}'; + protected $signature = 'backpack:crud {name} {folder?} {--rf?}'; /** * The console command description. @@ -36,11 +36,20 @@ public function handle() $crudControllerName = "{$name}CrudController"; if (strlen($this->argument('folder')) > 1) { $folderName = ucfirst($this->argument('folder')); + $folderLowerName = strtolower($this->argument('folder')); $argumentsArray['folder'] = $folderName; $crudControllerName = "$folderName\\".$name."CrudController"; } - // Create the CRUD Controller and show output - $this->call('backpack:crud-controller', $argumentsArray); + + if ($this->option('rf') == true) { + // Create the CRUD Controller and show output + $this->call('backpack:crud-controller', array_merge($argumentsArray, [ + 'rf' => true + ])); + } else { + // Create the CRUD Controller and show output + $this->call('backpack:crud-controller', $argumentsArray); + } // Create the CRUD Model and show output $this->call('backpack:crud-model', $argumentsArray); @@ -49,13 +58,25 @@ public function handle() $this->call('backpack:crud-request', $argumentsArray); // Create the CRUD route - $this->call('backpack:add-custom-route', [ - 'code' => "Route::crud('$lowerName', '$crudControllerName');", - ]); - - // Create the sidebar item - $this->call('backpack:add-sidebar-content', [ - 'code' => "", - ]); + if (strlen($this->argument('folder')) > 1 && $this->option('rf') == true) { + $this->call('backpack:add-custom-route', [ + 'code' => "Route::crud('$folderLowerName/$lowerName', '$crudControllerName');", + ]); + + // Create the sidebar item + $this->call('backpack:add-sidebar-content', [ + 'code' => "", + ]); + } else { + $this->call('backpack:add-custom-route', [ + 'code' => "Route::crud('$lowerName', '$crudControllerName');", + ]); + + // Create the sidebar item + $this->call('backpack:add-sidebar-content', [ + 'code' => "", + ]); + } + } } diff --git a/src/Console/Commands/CrudControllerBackpackCommand.php b/src/Console/Commands/CrudControllerBackpackCommand.php index c11d0ea..ae7163a 100644 --- a/src/Console/Commands/CrudControllerBackpackCommand.php +++ b/src/Console/Commands/CrudControllerBackpackCommand.php @@ -20,7 +20,7 @@ class CrudControllerBackpackCommand extends GeneratorCommand * * @var string */ - protected $signature = 'backpack:crud-controller {name} {folder?}'; + protected $signature = 'backpack:crud-controller {name} {folder?} {--rf?}'; /** * The console command description. @@ -90,6 +90,12 @@ protected function replaceNameStrings(&$stub, $name) $table = Str::plural(ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', str_replace($this->getNamespace($name).'\\', '', $name))), '_')); $stub = str_replace('DummyTable', $table, $stub); + if (strlen($this->argument('folder')) > 1) { + $folderLowerName = strtolower($this->argument('folder')); + if ($this->option('rf') == true) { + $stub = str_replace('/dummy_class', '/'.$folderLowerName.'/'.strtolower(str_replace($this->getNamespace($name).'\\', '', $name)), $stub); + } + } $stub = str_replace('dummy_class', strtolower(str_replace($this->getNamespace($name).'\\', '', $name)), $stub); return $this; From 7d75ae44b17671ec4abed1ec6950e93e58fe58f3 Mon Sep 17 00:00:00 2001 From: iMokhles Date: Sun, 28 Feb 2021 15:25:57 +0100 Subject: [PATCH 6/7] improved --rf option and fixed issue --- src/Console/Commands/CrudBackpackCommand.php | 4 ++-- src/Console/Commands/CrudControllerBackpackCommand.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Console/Commands/CrudBackpackCommand.php b/src/Console/Commands/CrudBackpackCommand.php index ac91ef3..52a1fb1 100644 --- a/src/Console/Commands/CrudBackpackCommand.php +++ b/src/Console/Commands/CrudBackpackCommand.php @@ -12,7 +12,7 @@ class CrudBackpackCommand extends Command * * @var string */ - protected $signature = 'backpack:crud {name} {folder?} {--rf?}'; + protected $signature = 'backpack:crud {name} {folder?} {--rf}'; /** * The console command description. @@ -44,7 +44,7 @@ public function handle() if ($this->option('rf') == true) { // Create the CRUD Controller and show output $this->call('backpack:crud-controller', array_merge($argumentsArray, [ - 'rf' => true + '--rf' => true ])); } else { // Create the CRUD Controller and show output diff --git a/src/Console/Commands/CrudControllerBackpackCommand.php b/src/Console/Commands/CrudControllerBackpackCommand.php index ae7163a..a9be96f 100644 --- a/src/Console/Commands/CrudControllerBackpackCommand.php +++ b/src/Console/Commands/CrudControllerBackpackCommand.php @@ -20,7 +20,7 @@ class CrudControllerBackpackCommand extends GeneratorCommand * * @var string */ - protected $signature = 'backpack:crud-controller {name} {folder?} {--rf?}'; + protected $signature = 'backpack:crud-controller {name} {folder?} {--rf}'; /** * The console command description. @@ -182,6 +182,7 @@ protected function replaceModel(&$stub, $name) // replace CrudRequest $stub = str_replace('\DummyClassRequest', "\\".$folderName.'\\'.$class.'Request', $stub); + $stub = str_replace('DummyClassRequest', "\\".$folderName.'\\'.$class.'Request', $stub); // replace CrudModel $stub = str_replace('DummyClass::class', $folderName.'\\'.$class.'::class', $stub); From ca4fe0c39461022573fed47a1e76757249f1314a Mon Sep 17 00:00:00 2001 From: iMokhles Date: Sun, 28 Feb 2021 15:27:22 +0100 Subject: [PATCH 7/7] replace correct DummyClassRequest class_name --- src/Console/Commands/CrudControllerBackpackCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Commands/CrudControllerBackpackCommand.php b/src/Console/Commands/CrudControllerBackpackCommand.php index a9be96f..351ddc4 100644 --- a/src/Console/Commands/CrudControllerBackpackCommand.php +++ b/src/Console/Commands/CrudControllerBackpackCommand.php @@ -182,7 +182,7 @@ protected function replaceModel(&$stub, $name) // replace CrudRequest $stub = str_replace('\DummyClassRequest', "\\".$folderName.'\\'.$class.'Request', $stub); - $stub = str_replace('DummyClassRequest', "\\".$folderName.'\\'.$class.'Request', $stub); + $stub = str_replace('DummyClassRequest', $class.'Request', $stub); // replace CrudModel $stub = str_replace('DummyClass::class', $folderName.'\\'.$class.'::class', $stub);