feat: 完成独立的邀请与达人榜系统架构
This commit is contained in:
@@ -36,6 +36,7 @@ class User extends Authenticatable
|
||||
'sex',
|
||||
'sign',
|
||||
'user_level',
|
||||
'inviter_id',
|
||||
'room_id',
|
||||
'first_ip',
|
||||
'previous_ip',
|
||||
@@ -183,4 +184,20 @@ class User extends Authenticatable
|
||||
{
|
||||
return $this->activePosition()->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联:邀请当前用户的人
|
||||
*/
|
||||
public function inviter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(self::class, 'inviter_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联:当前用户邀请的所有人
|
||||
*/
|
||||
public function invitees(): HasMany
|
||||
{
|
||||
return $this->hasMany(self::class, 'inviter_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user