diff --git a/src/stubs/controller.full.stub b/src/stubs/controller.full.stub index 5bc5b73..7ee03b6 100644 --- a/src/stubs/controller.full.stub +++ b/src/stubs/controller.full.stub @@ -77,6 +77,8 @@ class MastersController extends Controller */ public function edit(Master $singleMstr) { + $this->authorize('update', $singleMstr); + return view('masters.edit', compact('singleMstr')); } diff --git a/src/stubs/view-edit.stub b/src/stubs/view-edit.stub index 22443f9..b56f976 100644 --- a/src/stubs/view-edit.stub +++ b/src/stubs/view-edit.stub @@ -45,7 +45,9 @@
{!! Form::close() !!} diff --git a/src/stubs/view-show.stub b/src/stubs/view-show.stub index c116667..e484327 100644 --- a/src/stubs/view-show.stub +++ b/src/stubs/view-show.stub @@ -20,7 +20,9 @@ diff --git a/tests/Generators/FullControllerGeneratorTest.php b/tests/Generators/FullControllerGeneratorTest.php index 6f91b40..e2c61c3 100644 --- a/tests/Generators/FullControllerGeneratorTest.php +++ b/tests/Generators/FullControllerGeneratorTest.php @@ -91,6 +91,8 @@ class {$this->plural_model_name}Controller extends Controller */ public function edit({$this->model_name} \${$this->single_model_var_name}) { + \$this->authorize('update', \${$this->single_model_var_name}); + return view('{$this->table_name}.edit', compact('{$this->single_model_var_name}')); } @@ -227,6 +229,8 @@ class CategoriesController extends Controller */ public function edit(Category \$category) { + \$this->authorize('update', \$category); + return view('categories.edit', compact('category')); } @@ -364,6 +368,8 @@ class CategoriesController extends Controller */ public function edit(Category \$category) { + \$this->authorize('update', \$category); + return view('categories.edit', compact('category')); } diff --git a/tests/Generators/ViewsGeneratorTest.php b/tests/Generators/ViewsGeneratorTest.php index c0a538b..1fcccb3 100644 --- a/tests/Generators/ViewsGeneratorTest.php +++ b/tests/Generators/ViewsGeneratorTest.php @@ -105,7 +105,9 @@ class ViewsGeneratorTest extends TestCase @@ -204,7 +206,9 @@ class ViewsGeneratorTest extends TestCase {!! Form::close() !!}