find($this->argument('account_id')); if (!$account) { $this->error('Account not found'); return 1; } if (!$account->node) { $this->error('Account has no hosting node assigned'); return 1; } $this->info("Re-provisioning account: {$account->username} on node {$account->node->hostname}"); try { $result = $provider->createAccount($account); $account->update([ 'status' => HostingAccount::STATUS_ACTIVE, 'home_directory' => $result['home_directory'], 'provisioned_at' => now(), ]); $this->info("Account provisioned successfully!"); $this->info("Username: {$result['username']}"); $this->info("Password: {$result['password']}"); $this->info("Home Directory: {$result['home_directory']}"); // Also provision any existing sites foreach ($account->sites as $site) { $this->info("Provisioning site: {$site->domain}"); try { $provider->addSite($site); $site->update(['status' => 'active']); $this->info(" - Site provisioned"); } catch (\Exception $e) { $this->warn(" - Failed: {$e->getMessage()}"); } } return 0; } catch (\Exception $e) { $this->error("Failed to provision: {$e->getMessage()}"); return 1; } } }