mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Redirect with error if model is invalid
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
1d97d95c10
commit
cf45e7536f
|
@ -34,12 +34,17 @@ class AssetCheckoutController extends Controller
|
|||
|
||||
$this->authorize('checkout', $asset);
|
||||
|
||||
if (!$asset->model) {
|
||||
return redirect()->route('hardware.show', $asset->id)->with('error', trans('admin/hardware/general.model_invalid_fix'));
|
||||
}
|
||||
|
||||
if ($asset->availableForCheckout()) {
|
||||
return view('hardware/checkout', compact('asset'))
|
||||
->with('statusLabel_list', Helper::deployableStatusLabelList())
|
||||
->with('table_name', 'Assets');
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkout.not_available'));
|
||||
}
|
||||
|
||||
|
@ -62,6 +67,11 @@ class AssetCheckoutController extends Controller
|
|||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkout.not_available'));
|
||||
}
|
||||
$this->authorize('checkout', $asset);
|
||||
|
||||
if (!$asset->model) {
|
||||
return redirect()->route('hardware.show', $asset->id)->with('error', trans('admin/hardware/general.model_invalid_fix'));
|
||||
}
|
||||
|
||||
$admin = Auth::user();
|
||||
|
||||
$target = $this->determineCheckoutTarget();
|
||||
|
|
Loading…
Reference in a new issue