mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
149 - Viewing Used or Invalid Invitations
This commit is contained in:
@@ -11,6 +11,8 @@ class InvitationsController extends Controller
|
||||
{
|
||||
$invitation = Invitation::findByCode($code);
|
||||
|
||||
abort_if($invitation->hasBeenUsed(), 404);
|
||||
|
||||
return view('invitations.show', [
|
||||
'invitation' => $invitation,
|
||||
]);
|
||||
|
||||
@@ -8,6 +8,11 @@ class Invitation extends Model
|
||||
{
|
||||
public static function findByCode($code)
|
||||
{
|
||||
return self::where('code', $code)->first();
|
||||
return self::where('code', $code)->firstOrFail();
|
||||
}
|
||||
|
||||
public function hasBeenUsed()
|
||||
{
|
||||
return $this->user_id !== null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user