Handle the signup invite

This commit is contained in:
Joseph Cohen
2015-11-08 13:43:45 -06:00
parent f6318409a7
commit 448f13e671
14 changed files with 427 additions and 8 deletions

View File

@@ -41,8 +41,28 @@ class Invite extends Model
self::creating(function ($invite) {
if (!$invite->code) {
$invite->code = self::generateVerifyCode();
$invite->code = self::generateInviteCode();
}
});
}
/**
* Returns an invite code.
*
* @return string
*/
public static function generateInviteCode()
{
return str_random(20);
}
/**
* Determines if the invite was claimed.
*
* @return bool
*/
public function claimed()
{
return !is_null($this->claimed_at);
}
}