Update user service to be more separated
This commit is contained in:
parent
8daec38622
commit
275c01bc37
12 changed files with 473 additions and 1361 deletions
|
@ -27,8 +27,6 @@ namespace Pterodactyl\Repositories\Eloquent;
|
|||
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Repositories\Eloquent\Attributes\SearchableRepository;
|
||||
|
||||
|
@ -76,24 +74,6 @@ class UserRepository extends SearchableRepository implements UserRepositoryInter
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteIfNoServers($id)
|
||||
{
|
||||
$user = $this->getBuilder()->withCount('servers')->where('id', $id)->first();
|
||||
|
||||
if (! $user) {
|
||||
throw new RecordNotFoundException();
|
||||
}
|
||||
|
||||
if ($user->servers_count > 0) {
|
||||
throw new DisplayException('Cannot delete an account that has active servers attached to it.');
|
||||
}
|
||||
|
||||
return $user->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue