Files

31 lines
756 B
PHP
Raw Permalink Normal View History

<?php
2017-10-06 23:57:53 -05:00
namespace Pterodactyl\Services\Nests;
2017-10-06 23:57:53 -05:00
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
2017-10-06 23:57:53 -05:00
class NestUpdateService
{
/**
2017-10-06 23:57:53 -05:00
* NestUpdateService constructor.
*/
2022-10-14 10:59:20 -06:00
public function __construct(protected NestRepositoryInterface $repository)
{
}
/**
2017-10-06 23:57:53 -05:00
* Update a nest and prevent changing the author once it is set.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
2022-10-14 10:59:20 -06:00
public function handle(int $nest, array $data): void
{
2021-01-23 12:33:34 -08:00
if (!is_null(array_get($data, 'author'))) {
unset($data['author']);
}
2018-01-05 16:33:50 -06:00
$this->repository->withoutFreshModel()->update($nest, $data);
}
}