Fix legacy RC hosting orders not appearing after app extraction.
Deploy Ladill Hosting / deploy (push) Successful in 23s

Import RC service orders in hosting:import, map platform_id on legacy models, and wire legacy order manage links to hosting.legacy.show.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-06 20:31:29 +00:00
co-authored by Cursor
parent 8205d55d1e
commit d532f5b206
6 changed files with 53 additions and 2 deletions
@@ -11,6 +11,7 @@ use App\Models\HostingNode;
use App\Models\HostingOrder;
use App\Models\HostingPlanChange;
use App\Models\HostingProduct;
use App\Models\RcServiceOrder;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
@@ -82,6 +83,9 @@ class ImportHostingCommand extends Command
foreach ($payload['hosting_orders'] ?? [] as $row) {
$this->importLegacyOrder($row, $commit);
}
foreach ($payload['rc_service_orders'] ?? [] as $row) {
$this->importRcServiceOrder($row, $commit);
}
foreach ($payload['hosting_account_members'] ?? [] as $row) {
$this->importMember($row, $commit);
}
@@ -224,6 +228,24 @@ class ImportHostingCommand extends Command
}
}
/** @param array<string, mixed> $row */
private function importRcServiceOrder(array $row, bool $commit): void
{
$platformId = (int) ($row['id'] ?? 0);
$owner = $this->resolveUser((string) ($row['owner_public_id'] ?? ''));
if (! $owner) {
return;
}
unset($row['id'], $row['owner_public_id'], $row['owner_email']);
$row['user_id'] = $owner->id;
$row['platform_id'] = $platformId;
if ($commit) {
RcServiceOrder::updateOrCreate(['platform_id' => $platformId], $row);
}
}
/** @param array<string, mixed> $row */
private function importMember(array $row, bool $commit): void
{
@@ -207,7 +207,7 @@ class HostingController extends Controller
if ($hostingOrder->rc_order_id && $hosting->isConfigured()) {
$result = $hosting->deleteOrder($hostingOrder->rc_order_id);
if (! $result['success']) {
return redirect()->route('hosting.show', $hostingOrder)
return redirect()->route('hosting.legacy.show', $hostingOrder)
->with('error', $result['message'] ?? 'Could not cancel hosting at this time.');
}
}
+2
View File
@@ -24,6 +24,7 @@ class HostingOrder extends Model
public const TYPE_RESELLER = 'reseller';
protected $fillable = [
'platform_id',
'user_id',
'domain_id',
'domain_name',
@@ -40,6 +41,7 @@ class HostingOrder extends Model
'expires_at',
'provisioned_at',
'meta',
'is_legacy_rc',
];
protected $casts = [
+1
View File
@@ -41,6 +41,7 @@ class RcServiceOrder extends Model
public const FULFILLMENT_FAILED = 'failed';
protected $fillable = [
'platform_id',
'user_id',
'category',
'order_type',
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (Schema::hasTable('rc_service_orders') && ! Schema::hasColumn('rc_service_orders', 'platform_id')) {
Schema::table('rc_service_orders', function (Blueprint $table): void {
$table->unsignedBigInteger('platform_id')->nullable()->unique()->after('id');
});
}
}
public function down(): void
{
if (Schema::hasTable('rc_service_orders') && Schema::hasColumn('rc_service_orders', 'platform_id')) {
Schema::table('rc_service_orders', function (Blueprint $table): void {
$table->dropColumn('platform_id');
});
}
}
};
+1 -1
View File
@@ -241,7 +241,7 @@
</td>
<td class="px-5 py-3 text-gray-500">{{ $order->expires_at?->format('M j, Y') ?? '—' }}</td>
<td class="px-5 py-3 text-right">
<a href="{{ route('hosting.show', $order) }}" class="inline-flex items-center gap-1 rounded-lg border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-700 transition hover:bg-gray-50">
<a href="{{ route('hosting.legacy.show', $order) }}" class="inline-flex items-center gap-1 rounded-lg border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-700 transition hover:bg-gray-50">
Manage
<svg class="h-3 w-3" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5"/>