mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-08 19:25:10 -05:00
Now players get added to the queue and the controller tries to create matches when enough matching players are in the Queue.
46 lines
858 B
PHP
46 lines
858 B
PHP
<?php
|
|
|
|
namespace App\Models\Game\Matchmaking;
|
|
|
|
use App\Enums\Game\Matchmaking\MatchmakingSide;
|
|
use App\Models\User\User;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @mixin IdeHelperQueuedPlayer
|
|
*/
|
|
class QueuedPlayer extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'side',
|
|
];
|
|
|
|
protected $casts = [
|
|
'side' => MatchmakingSide::class,
|
|
];
|
|
|
|
protected static function boot()
|
|
{
|
|
parent::boot();
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function followingUsers()
|
|
{
|
|
return $this->hasMany(QueuedPlayer::class, 'queued_player_id');
|
|
}
|
|
|
|
public function leader()
|
|
{
|
|
return $this->belongsTo(QueuedPlayer::class, 'queued_player_id');
|
|
}
|
|
}
|