Path: blob/1.0-develop/app/Repositories/Eloquent/SessionRepository.php
7460 views
<?php12namespace Pterodactyl\Repositories\Eloquent;34use Pterodactyl\Models\Session;5use Illuminate\Support\Collection;6use Pterodactyl\Contracts\Repository\SessionRepositoryInterface;78class SessionRepository extends EloquentRepository implements SessionRepositoryInterface9{10/**11* Return the model backing this repository.12*/13public function model(): string14{15return Session::class;16}1718/**19* Return all the active sessions for a user.20*/21public function getUserSessions(int $user): Collection22{23return $this->getBuilder()->where('user_id', $user)->get($this->getColumns());24}2526/**27* Delete a session for a given user.28*/29public function deleteUserSession(int $user, string $session): ?int30{31return $this->getBuilder()->where('user_id', $user)->where('id', $session)->delete();32}33}343536