Add condition in LicenseCheckinController:bulkCheckin method to evaluate if the license is reassignable

This commit is contained in:
Ivan Nieto Vivanco 2023-08-23 16:22:40 -06:00
parent d393bd5c97
commit 6161a0d76d

View file

@ -128,6 +128,13 @@ class LicenseCheckinController extends Controller
$license = License::findOrFail($licenseId);
$this->authorize('checkin', $license);
if (! $license->reassignable) {
// Not allowed to checkin
Session::flash('error', 'License not reassignable.');
return redirect()->back()->withInput();
}
$licenseSeatsByUser = LicenseSeat::where('license_id', '=', $licenseId)
->whereNotNull('assigned_to')
->with('user')