customerId === null) { return false; } DB::table('services')->updateOrInsert( ['legacy_id' => $data->legacyId], [ 'uuid' => DB::table('services')->where('legacy_id', $data->legacyId)->value('uuid') ?? (string) Str::uuid(), 'customer_id' => $data->customerId, 'product_id' => $data->productId, 'legacy_product_id' => $data->legacyProductId, 'order_item_id' => $data->orderItemId, 'server_name' => $data->serverName, 'status' => $data->status, 'auto_renew' => $data->autoRenew, 'started_at' => $data->startedAt, 'expires_at' => $data->expiresAt, 'cancelled_at' => $data->cancelledAt, 'note' => $data->note, ] ); return true; } }