Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handle the logic to determine if we should display the license checkout blade [ch13792] #8141

Merged
merged 1 commit into from
Jun 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/Http/Controllers/LicensesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,23 @@ public function destroy($licenseId)
*/
public function getCheckout($licenceId)
{

// Check that the license is valid
if ($license = License::where('id',$licenceId)->first()) {

$this->authorize('checkout', $license);

// If the license is valid, check that there is an available seat
if ($license->getAvailSeatsCountAttribute() < 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 view('licenses/checkout', compact('license'));
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));



}


Expand Down