Files
ladill-servers/app/Console/Commands/RetryPendingHostingFulfillmentCommand.php
T
isaaccladandCursor b6c8ac343f Extract Ladill Servers as standalone app at servers.ladill.com.
VPS and dedicated server ordering, managed panels, SSO, billing, and launcher integration — forked from hosting infrastructure with server-focused routes and dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 19:18:30 +00:00

44 lines
1.3 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Models\CustomerHostingOrder;
use App\Jobs\ProvisionHostingOrderJob;
use Illuminate\Console\Command;
class RetryPendingHostingFulfillmentCommand extends Command
{
protected $signature = 'hosting:retry-pending-fulfillment {--limit=50 : Maximum orders to process}';
protected $description = 'Re-queue provisioning for hosting orders held after an upstream failure (e.g. Contabo balance)';
public function handle(): int
{
$limit = max(1, (int) $this->option('limit'));
$orders = CustomerHostingOrder::query()
->where('status', CustomerHostingOrder::STATUS_PENDING_APPROVAL)
->whereNotNull('meta->provisioning_hold')
->with('product')
->latest('id')
->limit($limit)
->get();
$queued = 0;
foreach ($orders as $order) {
$order->update([
'status' => CustomerHostingOrder::STATUS_APPROVED,
'approved_at' => now(),
]);
ProvisionHostingOrderJob::dispatch($order->fresh());
$queued++;
$this->line("Queued provisioning for order #{$order->id} ({$order->domain_name})");
}
$this->info("Queued {$queued} order(s) for reprovisioning.");
return self::SUCCESS;
}
}