From 7937542dcbbfeb3b560e54e4d2ad60f909b8baca Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 29 Jun 2023 21:15:50 +0100 Subject: [PATCH] =?UTF-8?q?Redirect=20if=20the=20license=20can=E2=80=99t?= =?UTF-8?q?=20be=20found?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: snipe --- app/Http/Controllers/Licenses/LicenseCheckoutController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Licenses/LicenseCheckoutController.php b/app/Http/Controllers/Licenses/LicenseCheckoutController.php index a710497692..3a0f806584 100644 --- a/app/Http/Controllers/Licenses/LicenseCheckoutController.php +++ b/app/Http/Controllers/Licenses/LicenseCheckoutController.php @@ -30,15 +30,17 @@ class LicenseCheckoutController extends Controller // Check that the license is valid if ($license = License::find($licenseId)) { + $this->authorize('checkout', $license); // If the license is valid, check that there is an available seat if ($license->avail_seats_count < 1) { return redirect()->route('licenses.index')->with('error', 'There are no available seats for this license'); } + return view('licenses/checkout', compact('license')); } - $this->authorize('checkout', $license); + return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found')); + - return view('licenses/checkout', compact('license')); } /**