Add subuser deletion service

This commit is contained in:
Dane Everitt 2017-08-26 13:31:18 -05:00
parent 74ea1aa0aa
commit 2cabb61b54
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 276 additions and 1 deletions

View file

@ -25,7 +25,9 @@
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Contracts\Repository\SubuserRepositoryInterface;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
use Pterodactyl\Models\Subuser;
use Webmozart\Assert\Assert;
class SubuserRepository extends EloquentRepository implements SubuserRepositoryInterface
{
@ -36,4 +38,19 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI
{
return Subuser::class;
}
/**
* {@inheritdoc}
*/
public function getWithServerAndPermissions($id)
{
Assert::numeric($id, 'First argument passed to getWithServerAndPermissions must be numeric, received %s.');
$instance = $this->getBuilder()->with(['server', 'permission'])->find($id, $this->getColumns());
if (! $instance) {
throw new RecordNotFoundException;
}
return $instance;
}
}