mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
exam add max user count
This commit is contained in:
@@ -11,7 +11,7 @@ class Exam extends NexusModel
|
||||
{
|
||||
protected $fillable = [
|
||||
'name', 'description', 'begin', 'end', 'duration', 'status', 'is_discovered', 'filters', 'indexes', 'priority',
|
||||
'recurring', 'type', 'success_reward_bonus', 'fail_deduct_bonus'
|
||||
'recurring', 'type', 'success_reward_bonus', 'fail_deduct_bonus', 'max_user_count'
|
||||
];
|
||||
|
||||
public $timestamps = true;
|
||||
@@ -294,4 +294,14 @@ class Exam extends NexusModel
|
||||
return $this->type == self::TYPE_TASK;
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class, "exam_users", "exam_id", "uid");
|
||||
}
|
||||
|
||||
public function OnGoingUsers()
|
||||
{
|
||||
return $this->users()->wherePivot("status", ExamUser::STATUS_NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user