whereIn('id', [$transfer->old_allocation, ...($transfer->old_additional_allocations ?? [])]) ->update(['server_id' => null]); $server = $transfer->server; $server->update([ 'allocation_id' => $transfer->new_allocation, 'node_id' => $transfer->new_node, ]); $transfer->update(['successful' => true]); Event::dispatch(new OperationCompleted($server->uuid, 'transfer', true, $server->uuid)); return $server->refresh(); }); // Point the delete at the old node so the freshly transferred copy is left alone. try { Daemon::server($server, $transfer->oldNode) ->delete(); } catch (DaemonConnectionException $daemonConnectionException) { Log::warning($daemonConnectionException->getMessage(), ['exception' => $daemonConnectionException, 'transfer_id' => $transfer->id]); } return $server; } }