From 13586be6b087c294fb459991688ea6b469f1194d Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 19 Oct 2017 03:37:27 -0700 Subject: [PATCH] Fixed load error if license is invalid --- app/Http/Controllers/LicensesController.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index 84891a21e..2d0dcf5a4 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -441,17 +441,15 @@ class LicensesController extends Controller public function show($licenseId = null) { - $license = License::find($licenseId); - $license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset'); + $license = License::with('assignedusers', 'licenseSeats.user', 'licenseSeats.asset')->find($licenseId); - if (isset($license->id)) { - $license = $license->load('assignedusers', 'licenseSeats.user', 'licenseSeats.asset'); + if ($license) { $this->authorize('view', $license); return view('licenses/view', compact('license')); } - $error = trans('admin/licenses/message.does_not_exist', compact('id')); - return redirect()->route('licenses.index')->with('error', $error); + return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id'))); } + public function getClone($licenseId = null) {