Make sure the asset is available for checkout before displaying the checkout screen

This commit is contained in:
snipe 2017-11-27 21:18:29 -08:00
parent 305b0d8edb
commit 804b49cefb

View file

@ -431,8 +431,13 @@ class AssetsController extends Controller
$this->authorize('checkout', $asset);
if ($asset->availableForCheckout()) {
return view('hardware/checkout', compact('asset'));
}
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkout.not_available'));
// Get the dropdown of users and then pass it to the checkout view
return view('hardware/checkout', compact('asset'));
}
/**