Added quiz new features
This commit is contained in:
@@ -21,6 +21,9 @@ class User extends Authenticatable
|
||||
'is_admin',
|
||||
'email',
|
||||
'password',
|
||||
'xp',
|
||||
'duels_played',
|
||||
'duels_won',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
@@ -67,4 +70,25 @@ class User extends Authenticatable
|
||||
->withPivot('read_at')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// --- NEW: Gamification Relationships ---
|
||||
// ==========================================
|
||||
|
||||
/**
|
||||
* Get all quest records for the user.
|
||||
*/
|
||||
public function userQuests()
|
||||
{
|
||||
return $this->hasMany(UserQuest::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper relationship to quickly get ONLY active, unexpired quests.
|
||||
*/
|
||||
public function activeQuests()
|
||||
{
|
||||
return $this->hasMany(UserQuest::class)
|
||||
->where('expires_at', '>', now());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user