mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 17:12:30 +01:00
cbcf62086f
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
31 lines
756 B
PHP
31 lines
756 B
PHP
<?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
|
|
{
|
|
if (!is_null(array_get($data, 'author'))) {
|
|
unset($data['author']);
|
|
}
|
|
|
|
$this->repository->withoutFreshModel()->update($nest, $data);
|
|
}
|
|
}
|