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
{