Remove ServerRepository and ServerRepositoryInterface

This commit is contained in:
Lance Pioch 2022-10-20 21:17:03 -04:00
parent 22d560de64
commit 4d7ea155b1
19 changed files with 63 additions and 146 deletions

View file

@ -2,10 +2,10 @@
namespace Pterodactyl\Services\Eggs;
use Pterodactyl\Models\Server;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Exceptions\Service\Egg\HasChildrenException;
use Pterodactyl\Exceptions\Service\HasActiveServersException;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
class EggDeletionService
{
@ -13,7 +13,6 @@ class EggDeletionService
* EggDeletionService constructor.
*/
public function __construct(
protected ServerRepositoryInterface $serverRepository,
protected EggRepositoryInterface $repository
) {
}
@ -26,8 +25,7 @@ class EggDeletionService
*/
public function handle(int $egg): int
{
$servers = $this->serverRepository->findCountWhere([['egg_id', '=', $egg]]);
if ($servers > 0) {
if (Server::query()->where('egg_id', $egg)->count()) {
throw new HasActiveServersException(trans('exceptions.nest.egg.delete_has_servers'));
}