serverRepository->findCountWhere([['egg_id', '=', $egg]]); if ($servers > 0) { throw new HasActiveServersException(trans('exceptions.nest.egg.delete_has_servers')); } $children = Egg::query()->where('config_from', $egg)->count(); if ($children > 0) { throw new HasChildrenException(trans('exceptions.nest.egg.has_children')); } $egg = Egg::query()->findOrFail($egg); return $egg->delete(); } }