connection = $connection; $this->repository = $repository; } /** * Update the details for a single server instance. * * @param \Pterodactyl\Models\Server $server * @param array $data * @return bool|\Pterodactyl\Models\Server * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function handle(Server $server, array $data) { $this->connection->beginTransaction(); $response = $this->repository->setFreshModel($this->getUpdatedModel())->update($server->id, [ 'external_id' => array_get($data, 'external_id'), 'owner_id' => array_get($data, 'owner_id'), 'name' => array_get($data, 'name'), 'description' => array_get($data, 'description') ?? '', ], true, true); $this->connection->commit(); return $response; } }