update email template
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Whmcs;
|
||||
|
||||
use App\Integrations\Whmcs\Extractors\ServiceExtractor;
|
||||
use App\Integrations\Whmcs\Transformers\ServiceTransformer;
|
||||
use App\Integrations\Whmcs\Writers\ServiceWriter;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SyncServicesCommand extends Command
|
||||
{
|
||||
protected $signature = 'whmcs:sync-services';
|
||||
|
||||
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();
|
||||
|
||||
$bar = $this->output->createProgressBar($total);
|
||||
$bar->start();
|
||||
|
||||
$skipped = 0;
|
||||
foreach ($extractor->extract() as $row) {
|
||||
if (! $writer->write($transformer->transform($row))) {
|
||||
$skipped++;
|
||||
}
|
||||
$bar->advance();
|
||||
}
|
||||
|
||||
$bar->finish();
|
||||
$this->newLine();
|
||||
$this->info("Processed {$total} service(s), skipped {$skipped} (unresolved customer).");
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user