mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Fixed load error if license is invalid
This commit is contained in:
parent
44c649c3c8
commit
13586be6b0
|
@ -441,18 +441,16 @@ class LicensesController extends Controller
|
||||||
public function show($licenseId = null)
|
public function show($licenseId = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$license = License::find($licenseId);
|
$license = License::with('assignedusers', 'licenseSeats.user', 'licenseSeats.asset')->find($licenseId);
|
||||||
$license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset');
|
|
||||||
|
|
||||||
if (isset($license->id)) {
|
if ($license) {
|
||||||
$license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset');
|
|
||||||
$this->authorize('view', $license);
|
$this->authorize('view', $license);
|
||||||
return view('licenses/view', compact('license'));
|
return view('licenses/view', compact('license'));
|
||||||
}
|
}
|
||||||
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
|
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));
|
||||||
return redirect()->route('licenses.index')->with('error', $error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getClone($licenseId = null)
|
public function getClone($licenseId = null)
|
||||||
{
|
{
|
||||||
if (is_null($license_to_clone = License::find($licenseId))) {
|
if (is_null($license_to_clone = License::find($licenseId))) {
|
||||||
|
|
Loading…
Reference in a new issue