Add basic subuser listing for servers

This commit is contained in:
Dane Everitt 2019-11-03 12:20:11 -08:00
parent de464d35a2
commit 543884876f
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
14 changed files with 310 additions and 4 deletions

View file

@ -3,6 +3,7 @@
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\Subuser;
use Illuminate\Support\Collection;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Contracts\Repository\SubuserRepositoryInterface;
@ -18,6 +19,22 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI
return Subuser::class;
}
/**
* Returns the subusers for the given server instance with the associated user
* and permission relationships pre-loaded.
*
* @param int $server
* @return \Illuminate\Support\Collection
*/
public function getSubusersForServer(int $server): Collection
{
return $this->getBuilder()
->with('user', 'permissions')
->where('server_id', $server)
->get()
->toBase();
}
/**
* Return a subuser with the associated server relationship.
*