150 - Registering with a Valid Invitation

This commit is contained in:
Adam Wathan
2017-12-08 13:20:30 -05:00
parent db7ba7effd
commit a70f95618c
5 changed files with 89 additions and 55 deletions

View File

@@ -6,11 +6,18 @@ use Illuminate\Database\Eloquent\Model;
class Invitation extends Model
{
protected $guarded = [];
public static function findByCode($code)
{
return self::where('code', $code)->firstOrFail();
}
public function user()
{
return $this->belongsTo(User::class);
}
public function hasBeenUsed()
{
return $this->user_id !== null;