Removed unused interface functions

This commit is contained in:
Dane Everitt 2020-09-13 12:37:59 -07:00
parent 8b4bd3945d
commit 9410a54c98
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 0 additions and 60 deletions

View file

@ -2,25 +2,6 @@
namespace Pterodactyl\Contracts\Repository; namespace Pterodactyl\Contracts\Repository;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
interface UserRepositoryInterface extends RepositoryInterface interface UserRepositoryInterface extends RepositoryInterface
{ {
/**
* Return all matching models for a user in a format that can be used for dropdowns.
*
* @param string|null $query
* @return \Illuminate\Support\Collection
*/
public function filterUsersByQuery(?string $query): Collection;
/**
* Returns a user with the given id in a format that can be used for dropdowns.
*
* @param int $id
* @return \Pterodactyl\Models\Model
*/
public function filterById(int $id): \Pterodactyl\Models\Model;
} }

View file

@ -3,8 +3,6 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface; use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
class UserRepository extends EloquentRepository implements UserRepositoryInterface class UserRepository extends EloquentRepository implements UserRepositoryInterface
@ -18,43 +16,4 @@ class UserRepository extends EloquentRepository implements UserRepositoryInterfa
{ {
return User::class; return User::class;
} }
/**
* Return all matching models for a user in a format that can be used for dropdowns.
*
* @param string|null $query
* @return \Illuminate\Support\Collection
*/
public function filterUsersByQuery(?string $query): Collection
{
$this->setColumns([
'id', 'email', 'username', 'name_first', 'name_last',
]);
$instance = $this->getBuilder()->get($this->getColumns());
return $instance->transform(function ($item) {
$item->md5 = md5(strtolower($item->email));
return $item;
});
}
/**
* Returns a user with the given id in a format that can be used for dropdowns.
*
* @param int $id
* @return \Pterodactyl\Models\Model
*/
public function filterById(int $id): \Pterodactyl\Models\Model
{
$this->setColumns([
'id', 'email', 'username', 'name_first', 'name_last',
]);
$model = $this->getBuilder()->findOrFail($id, $this->getColumns())->getModel();
$model->md5 = md5(strtolower($model->email));
return $model;
}
} }