mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 14:23:44 +02:00
Update user service to be more separated
This commit is contained in:
@@ -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}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user