1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00
Pterodactyl-Panel/app/Services/Nests/NestUpdateService.php
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00

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);
}
}