repository = $repository; $this->translator = $translator; $this->serverRepository = $serverRepository; } /** * Delete a user from the panel only if they have no servers attached to their account. * * @throws \Pterodactyl\Exceptions\DisplayException */ public function handle(User $user): void { $servers = $this->serverRepository->setColumns('id')->findCountWhere([['owner_id', '=', $user->id]]); if ($servers > 0) { throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers')); } $this->repository->delete($user->id); } }