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:
co-authored by
Claude Sonnet 5.5
parent
3c7710f1de
commit
a443ec3bf6
@@ -4,24 +4,25 @@ namespace App\Console\Commands\Whmcs;
|
||||
|
||||
use App\Integrations\Whmcs\Extractors\ClientExtractor;
|
||||
use App\Jobs\Whmcs\SyncClientJob;
|
||||
use App\Integrations\Whmcs\Support\SyncReport;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SyncClientsCommand extends Command
|
||||
{
|
||||
protected $signature = 'whmcs:sync-clients {--sync : Run each record inline instead of queueing it}';
|
||||
protected $signature = 'whmcs:sync-clients {--sync : Run each record inline instead of queueing it} {--missing-only : Only records not yet synced (new, or order without customer)}';
|
||||
|
||||
protected $description = 'Extract clients from the WHMCS database and upsert them into customers';
|
||||
|
||||
public function handle(ClientExtractor $extractor): int
|
||||
{
|
||||
$sync = (bool) $this->option('sync');
|
||||
$total = DB::connection('whmcs')->table('tblclients')->count();
|
||||
$missingOnly = (bool) $this->option('missing-only');
|
||||
$total = $extractor->extract($missingOnly)->count();
|
||||
|
||||
$bar = $this->output->createProgressBar($total);
|
||||
$bar->start();
|
||||
|
||||
foreach ($extractor->extract() as $row) {
|
||||
foreach ($extractor->extract($missingOnly) as $row) {
|
||||
$job = new SyncClientJob((array) $row);
|
||||
$sync ? dispatch_sync($job) : dispatch($job);
|
||||
$bar->advance();
|
||||
@@ -31,6 +32,8 @@ class SyncClientsCommand extends Command
|
||||
$this->newLine();
|
||||
$this->info("Dispatched {$total} client(s) for sync.");
|
||||
|
||||
app(SyncReport::class)->finish($this);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user