2017-07-19 20:49:41 -05:00
|
|
|
<?php
|
|
|
|
|
2017-10-06 23:57:53 -05:00
|
|
|
namespace Pterodactyl\Services\Nests;
|
2017-07-19 20:49:41 -05:00
|
|
|
|
2022-10-23 20:15:11 -04:00
|
|
|
use Pterodactyl\Models\Nest;
|
2017-08-15 22:21:47 -05:00
|
|
|
|
2017-10-06 23:57:53 -05:00
|
|
|
class NestUpdateService
|
2017-07-19 20:49:41 -05:00
|
|
|
{
|
2017-08-15 22:21:47 -05:00
|
|
|
/**
|
2017-10-06 23:57:53 -05:00
|
|
|
* Update a nest and prevent changing the author once it is set.
|
2017-08-15 22:21:47 -05:00
|
|
|
*
|
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function handle(int $nest, array $data): void
|
2017-08-15 22:21:47 -05:00
|
|
|
{
|
2021-01-23 12:33:34 -08:00
|
|
|
if (!is_null(array_get($data, 'author'))) {
|
2017-08-15 22:21:47 -05:00
|
|
|
unset($data['author']);
|
|
|
|
}
|
|
|
|
|
2022-10-23 20:15:11 -04:00
|
|
|
$nest = Nest::query()->findOrFail($nest);
|
|
|
|
$nest->update($data);
|
2017-08-15 22:21:47 -05:00
|
|
|
}
|
2017-07-19 20:49:41 -05:00
|
|
|
}
|