Path: blob/1.0-develop/app/Services/Nests/NestCreationService.php
10262 views
<?php12namespace Pterodactyl\Services\Nests;34use Ramsey\Uuid\Uuid;5use Pterodactyl\Models\Nest;6use Pterodactyl\Contracts\Repository\NestRepositoryInterface;7use Illuminate\Contracts\Config\Repository as ConfigRepository;89class NestCreationService10{11/**12* NestCreationService constructor.13*/14public function __construct(private ConfigRepository $config, private NestRepositoryInterface $repository)15{16}1718/**19* Create a new nest on the system.20*21* @throws \Pterodactyl\Exceptions\Model\DataValidationException22*/23public function handle(array $data, ?string $author = null): Nest24{25return $this->repository->create([26'uuid' => Uuid::uuid4()->toString(),27'author' => $author ?? $this->config->get('pterodactyl.service.author'),28'name' => array_get($data, 'name'),29'description' => array_get($data, 'description'),30], true, true);31}32}333435