From 132a5d424d19b2775dca7b9b31b0e2607faa2c87 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 23 Apr 2018 16:04:01 -0700 Subject: [PATCH] Check for valid accessory category --- app/Http/Controllers/AccessoriesController.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/AccessoriesController.php b/app/Http/Controllers/AccessoriesController.php index c651ab3390..50723d47db 100755 --- a/app/Http/Controllers/AccessoriesController.php +++ b/app/Http/Controllers/AccessoriesController.php @@ -258,10 +258,17 @@ class AccessoriesController extends Controller return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.not_found')); } - $this->authorize('checkout', $accessory); + if ($accessory->category) { + + $this->authorize('checkout', $accessory); + + // Get the dropdown of users and then pass it to the checkout view + return view('accessories/checkout', compact('accessory')); + } + + return redirect()->back()->with('error', 'The category type for this accessory is not valid. Edit the accessory and select a valid accessory category.'); + - // Get the dropdown of users and then pass it to the checkout view - return view('accessories/checkout', compact('accessory')); }