misc_pterodactyl-panel/app/Services/Nests/NestUpdateService.php

31 lines
756 B
PHP
Raw Normal View History

<?php
namespace Pterodactyl\Services\Nests;
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
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
{
2021-01-23 20:33:34 +00:00
if (!is_null(array_get($data, 'author'))) {
unset($data['author']);
}
2018-01-05 22:33:50 +00:00
$this->repository->withoutFreshModel()->update($nest, $data);
}
}