149 - Viewing Used or Invalid Invitations

This commit is contained in:
Adam Wathan
2017-12-08 12:56:19 -05:00
parent ac4d968597
commit db7ba7effd
4 changed files with 33 additions and 2 deletions

View File

@@ -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;
}
}