Land on account overview and import hosted sites.
Deploy Ladill Hosting / deploy (push) Successful in 25s

Route launcher and home hub entry to the account overview instead of the
control panel, label the sidebar app launcher, and extend hosting:import
to sync hosted_sites with platform_id matching for existing accounts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-06 17:13:46 +00:00
co-authored by Cursor
parent 1e134a8e4b
commit e39a47fa1f
6 changed files with 69 additions and 8 deletions
+46 -1
View File
@@ -3,6 +3,7 @@
namespace App\Console\Commands;
use App\Models\CustomerHostingOrder;
use App\Models\HostedSite;
use App\Models\HostingAccount;
use App\Models\HostingAccountMember;
use App\Models\HostingBillingInvoice;
@@ -72,6 +73,9 @@ class ImportHostingCommand extends Command
foreach ($payload['hosting_accounts'] ?? [] as $row) {
$this->importAccount($row, $commit);
}
foreach ($payload['hosted_sites'] ?? [] as $row) {
$this->importSite($row, $commit);
}
foreach ($payload['customer_hosting_orders'] ?? [] as $row) {
$this->importCustomerOrder($row, $commit);
}
@@ -90,6 +94,10 @@ class ImportHostingCommand extends Command
});
$this->info(($commit ? 'Imported' : 'Would import').' '.count($this->accountMap).' hosting account(s).');
$siteCount = count($payload['hosted_sites'] ?? []);
if ($siteCount > 0) {
$this->info(($commit ? 'Imported' : 'Would import')." {$siteCount} hosted site(s).");
}
return self::SUCCESS;
}
@@ -134,7 +142,18 @@ class ImportHostingCommand extends Command
}
if ($commit) {
$account = HostingAccount::updateOrCreate(['platform_id' => $platformId], $row);
$account = HostingAccount::query()->where('platform_id', $platformId)->first();
if (! $account && ($row['username'] ?? '') !== '') {
$account = HostingAccount::query()->where('username', $row['username'])->first();
}
if ($account) {
$account->update($row);
} else {
$account = HostingAccount::create($row);
}
$this->accountMap[$platformId] = $account->id;
} else {
$this->accountMap[$platformId] = $platformId;
@@ -142,6 +161,32 @@ class ImportHostingCommand extends Command
}
}
/** @param array<string, mixed> $row */
private function importSite(array $row, bool $commit): void
{
$platformAccountId = (int) ($row['platform_hosting_account_id'] ?? 0);
$localAccountId = $this->accountMap[$platformAccountId] ?? null;
if (! $localAccountId) {
$this->warn("Skipping site {$row['domain']}: unknown hosting account #{$platformAccountId}");
return;
}
unset($row['platform_hosting_account_id'], $row['platform_id']);
$row['hosting_account_id'] = $localAccountId;
$row['domain_id'] = null;
if ($commit) {
HostedSite::withTrashed()->updateOrCreate(
['hosting_account_id' => $localAccountId, 'domain' => $row['domain']],
$row
);
} else {
$this->line(" site {$row['domain']} → account {$localAccountId}");
}
}
/** @param array<string, mixed> $row */
private function importCustomerOrder(array $row, bool $commit): void
{