Skip to content

A free open source IT asset/license management system

Check for valid accessory category

snipe132a5d424d19
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'));
}