2017-06-25 20:31:50 +00:00
|
|
|
<?php
|
2017-09-26 02:43:01 +00:00
|
|
|
/**
|
2017-06-25 20:31:50 +00:00
|
|
|
* Pterodactyl - Panel
|
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
|
|
|
*
|
2017-09-26 02:43:01 +00:00
|
|
|
* This software is licensed under the terms of the MIT license.
|
|
|
|
* https://opensource.org/licenses/MIT
|
2017-06-25 20:31:50 +00:00
|
|
|
*/
|
|
|
|
|
2017-08-31 02:11:14 +00:00
|
|
|
namespace Pterodactyl\Repositories\Eloquent;
|
2017-06-25 20:31:50 +00:00
|
|
|
|
2017-08-31 02:11:14 +00:00
|
|
|
use Pterodactyl\Models\Session;
|
|
|
|
use Pterodactyl\Contracts\Repository\SessionRepositoryInterface;
|
2017-06-25 20:31:50 +00:00
|
|
|
|
2017-08-31 02:11:14 +00:00
|
|
|
class SessionRepository extends EloquentRepository implements SessionRepositoryInterface
|
2017-06-25 20:31:50 +00:00
|
|
|
{
|
|
|
|
/**
|
2017-08-31 02:11:14 +00:00
|
|
|
* {@inheritdoc}
|
2017-06-25 20:31:50 +00:00
|
|
|
*/
|
2017-08-31 02:11:14 +00:00
|
|
|
public function model()
|
2017-06-25 20:31:50 +00:00
|
|
|
{
|
2017-08-31 02:11:14 +00:00
|
|
|
return Session::class;
|
2017-06-25 20:31:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-08-31 02:11:14 +00:00
|
|
|
* {@inheritdoc}
|
2017-06-25 20:31:50 +00:00
|
|
|
*/
|
2017-08-31 02:11:14 +00:00
|
|
|
public function getUserSessions($user)
|
2017-06-25 20:31:50 +00:00
|
|
|
{
|
2017-08-31 02:11:14 +00:00
|
|
|
return $this->getBuilder()->where('user_id', $user)->get($this->getColumns());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function deleteUserSession($user, $session)
|
|
|
|
{
|
|
|
|
return $this->getBuilder()->where('user_id', $user)->where('id', $session)->delete();
|
2017-06-25 20:31:50 +00:00
|
|
|
}
|
|
|
|
}
|