diff --git a/src/GeneratorCommand.php b/src/GeneratorCommand.php index 9e9cd17..c33ff95 100644 --- a/src/GeneratorCommand.php +++ b/src/GeneratorCommand.php @@ -102,6 +102,7 @@ class GeneratorCommand extends Command { $appNamespace = trim($this->getAppNamespace(), '\\'); $modelNamespace = str_replace('/', '\\', $appNamespace.'/'.ucfirst($modelPath)); + $modelNamespace = trim($modelNamespace, '\\'); return $modelNamespace == 'App\\' ? 'App' : $modelNamespace; } diff --git a/src/stubs/controller.full.stub b/src/stubs/controller.full.stub index 03d32b1..0d43fd2 100644 --- a/src/stubs/controller.full.stub +++ b/src/stubs/controller.full.stub @@ -51,9 +51,9 @@ class MastersController extends Controller 'description' => 'nullable|max:255', ]); - Master::create($request->only('name', 'description')); + $singleMstr = Master::create($request->only('name', 'description')); - return redirect()->route('masters.index'); + return redirect()->route('masters.show', $singleMstr); } /** diff --git a/src/stubs/view-index-full.stub b/src/stubs/view-index-full.stub index bacad5b..90a99fb 100644 --- a/src/stubs/view-index-full.stub +++ b/src/stubs/view-index-full.stub @@ -6,7 +6,7 @@