Files
portal-api/app/Integrations/Whmcs/Extractors/ServiceExtractor.php
T

23 lines
565 B
PHP

<?php
namespace App\Integrations\Whmcs\Extractors;
use App\Integrations\Whmcs\Support\SyncedLegacyIds;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\LazyCollection;
class ServiceExtractor
{
public function extract(bool $missingOnly = false): LazyCollection
{
$rows = DB::connection('whmcs')->table('tblhosting')->orderBy('id')->cursor();
if (! $missingOnly) {
return $rows;
}
$synced = SyncedLegacyIds::of('services');
return $rows->reject(fn ($row) => isset($synced[$row->id]));
}
}