fix: refactored the codebase

This commit is contained in:
2026-08-20 23:00:47 +02:00
parent 6f47ed0674
commit a77f74911d
64 changed files with 2864 additions and 1739 deletions
+14
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -14,6 +15,7 @@ use Illuminate\Support\Carbon;
* @property string $name
* @property bool $is_moderator
* @property Carbon|null $last_seen_at
* @property Carbon|null $inactive_at
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property-read Room $room
@@ -26,6 +28,7 @@ class Player extends Model
'name',
'is_moderator',
'last_seen_at',
'inactive_at',
];
protected function casts(): array
@@ -33,6 +36,7 @@ class Player extends Model
return [
'is_moderator' => 'boolean',
'last_seen_at' => 'datetime',
'inactive_at' => 'datetime',
];
}
@@ -79,4 +83,14 @@ class Player extends Model
'last_seen_at' => now(),
]);
}
/**
* @param Builder<Player> $query
* @return Builder<Player>
*/
public function scopeActive(Builder $query): Builder
{
return $query->whereNull('inactive_at');
}
}