Replace nest repository

This commit is contained in:
Lance Pioch 2022-10-23 20:15:11 -04:00
parent 860b2d890b
commit 43e419fd7e
15 changed files with 40 additions and 186 deletions

View file

@ -2,22 +2,13 @@
namespace Pterodactyl\Services\Nests;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
use Pterodactyl\Models\Nest;
class NestUpdateService
{
/**
* NestUpdateService constructor.
*/
public function __construct(protected NestRepositoryInterface $repository)
{
}
/**
* Update a nest and prevent changing the author once it is set.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle(int $nest, array $data): void
{
@ -25,6 +16,7 @@ class NestUpdateService
unset($data['author']);
}
$this->repository->withoutFreshModel()->update($nest, $data);
$nest = Nest::query()->findOrFail($nest);
$nest->update($data);
}
}