diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php index 8ee2c242f..cc9d197a4 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerTransferController.php @@ -112,10 +112,18 @@ class ServerTransferController extends Controller // Unsuspend the server and don't continue the transfer. if (! $request->input('successful')) { - $server->transfer->forceFill([ + $transfer = $server->transfer; + + $transfer->forceFill([ 'successful' => false, ])->saveOrFail(); + $allocationIds = json_decode($transfer->new_additional_allocations); + array_push($allocationIds, $transfer->new_allocation); + + // Release the reserved allocations. + $this->allocationRepository->updateWhereIn('id', $allocationIds, ['server_id' => null]); + return new JsonResponse([], Response::HTTP_NO_CONTENT); }