feat(portal): lead module, WHMCS sync report/contacts/mapping, service lifecycle email templates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-21 16:55:19 +07:00
co-authored by Claude Sonnet 5.5
parent 3c7710f1de
commit a443ec3bf6
66 changed files with 2032 additions and 124 deletions
@@ -5,24 +5,25 @@ namespace App\Console\Commands\Whmcs;
use App\Integrations\Whmcs\Extractors\ServiceExtractor;
use App\Integrations\Whmcs\Transformers\ServiceTransformer;
use App\Integrations\Whmcs\Writers\ServiceWriter;
use App\Integrations\Whmcs\Support\SyncReport;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class SyncServicesCommand extends Command
{
protected $signature = 'whmcs:sync-services';
protected $signature = 'whmcs:sync-services {--missing-only : Only records not yet synced (new, or order without customer)}';
protected $description = 'Extract provisioned services (tblhosting) from WHMCS and upsert them into services (run after whmcs:sync-clients, whmcs:sync-products, whmcs:sync-order-items)';
public function handle(ServiceExtractor $extractor, ServiceTransformer $transformer, ServiceWriter $writer): int
{
$total = DB::connection('whmcs')->table('tblhosting')->count();
$missingOnly = (bool) $this->option('missing-only');
$total = $extractor->extract($missingOnly)->count();
$bar = $this->output->createProgressBar($total);
$bar->start();
$skipped = 0;
foreach ($extractor->extract() as $row) {
foreach ($extractor->extract($missingOnly) as $row) {
if (! $writer->write($transformer->transform($row))) {
$skipped++;
}
@@ -33,6 +34,8 @@ class SyncServicesCommand extends Command
$this->newLine();
$this->info("Processed {$total} service(s), skipped {$skipped} (unresolved customer).");
app(SyncReport::class)->finish($this);
return Command::SUCCESS;
}
}