Replace session repository

This commit is contained in:
Lance Pioch 2022-10-24 00:44:59 -04:00
parent e49ba65709
commit e411707f4b
3 changed files with 0 additions and 55 deletions

View file

@ -1,18 +0,0 @@
<?php
namespace Pterodactyl\Contracts\Repository;
use Illuminate\Support\Collection;
interface SessionRepositoryInterface extends RepositoryInterface
{
/**
* Return all the active sessions for a user.
*/
public function getUserSessions(int $user): Collection;
/**
* Delete a session for a given user.
*/
public function deleteUserSession(int $user, string $session): ?int;
}

View file

@ -10,7 +10,6 @@ use Pterodactyl\Repositories\Eloquent\TaskRepository;
use Pterodactyl\Repositories\Eloquent\UserRepository; use Pterodactyl\Repositories\Eloquent\UserRepository;
use Pterodactyl\Repositories\Eloquent\ApiKeyRepository; use Pterodactyl\Repositories\Eloquent\ApiKeyRepository;
use Pterodactyl\Repositories\Eloquent\ServerRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository;
use Pterodactyl\Repositories\Eloquent\SessionRepository;
use Pterodactyl\Repositories\Eloquent\SubuserRepository; use Pterodactyl\Repositories\Eloquent\SubuserRepository;
use Pterodactyl\Repositories\Eloquent\DatabaseRepository; use Pterodactyl\Repositories\Eloquent\DatabaseRepository;
use Pterodactyl\Repositories\Eloquent\LocationRepository; use Pterodactyl\Repositories\Eloquent\LocationRepository;
@ -27,7 +26,6 @@ use Pterodactyl\Repositories\Eloquent\DatabaseHostRepository;
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface; use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Repositories\Eloquent\ServerVariableRepository; use Pterodactyl\Repositories\Eloquent\ServerVariableRepository;
use Pterodactyl\Contracts\Repository\SessionRepositoryInterface;
use Pterodactyl\Contracts\Repository\SubuserRepositoryInterface; use Pterodactyl\Contracts\Repository\SubuserRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
@ -58,7 +56,6 @@ class RepositoryServiceProvider extends ServiceProvider
$this->app->bind(ScheduleRepositoryInterface::class, ScheduleRepository::class); $this->app->bind(ScheduleRepositoryInterface::class, ScheduleRepository::class);
$this->app->bind(ServerRepositoryInterface::class, ServerRepository::class); $this->app->bind(ServerRepositoryInterface::class, ServerRepository::class);
$this->app->bind(ServerVariableRepositoryInterface::class, ServerVariableRepository::class); $this->app->bind(ServerVariableRepositoryInterface::class, ServerVariableRepository::class);
$this->app->bind(SessionRepositoryInterface::class, SessionRepository::class);
$this->app->bind(SettingsRepositoryInterface::class, SettingsRepository::class); $this->app->bind(SettingsRepositoryInterface::class, SettingsRepository::class);
$this->app->bind(SubuserRepositoryInterface::class, SubuserRepository::class); $this->app->bind(SubuserRepositoryInterface::class, SubuserRepository::class);
$this->app->bind(TaskRepositoryInterface::class, TaskRepository::class); $this->app->bind(TaskRepositoryInterface::class, TaskRepository::class);

View file

@ -1,34 +0,0 @@
<?php
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\Session;
use Illuminate\Support\Collection;
use Pterodactyl\Contracts\Repository\SessionRepositoryInterface;
class SessionRepository extends EloquentRepository implements SessionRepositoryInterface
{
/**
* Return the model backing this repository.
*/
public function model(): string
{
return Session::class;
}
/**
* Return all the active sessions for a user.
*/
public function getUserSessions(int $user): Collection
{
return $this->getBuilder()->where('user_id', $user)->get($this->getColumns());
}
/**
* Delete a session for a given user.
*/
public function deleteUserSession(int $user, string $session): ?int
{
return $this->getBuilder()->where('user_id', $user)->where('id', $session)->delete();
}
}