From 6066c249d5780d91e5fa33b4158b237c79f1fc4e Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 6 Mar 2020 16:01:13 -0800 Subject: [PATCH] Moved gate to the top of the method --- app/Http/Controllers/ManufacturersController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ManufacturersController.php b/app/Http/Controllers/ManufacturersController.php index c93aff906e..09752adb69 100755 --- a/app/Http/Controllers/ManufacturersController.php +++ b/app/Http/Controllers/ManufacturersController.php @@ -96,13 +96,14 @@ class ManufacturersController extends Controller */ public function edit($id = null) { + // Handles manufacturer checks and permissions. + $this->authorize('update', Manufacturer::class); + // Check if the manufacturer exists if (!$item = Manufacturer::find($id)) { return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist')); } - //Handles manufacturer checks and permissions. - $this->authorize('update', Manufacturer::class); - + // Show the page return view('manufacturers/edit', compact('item')); }