22 lines
526 B
PHP
22 lines
526 B
PHP
<?php
|
|
|
|
namespace App\Integrations\Whmcs\Support;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class SyncedLegacyIds
|
|
{
|
|
/**
|
|
* @return array<int|string, int> legacy ids already present locally, as a lookup set
|
|
*/
|
|
public static function of(string $table, bool $requireCustomer = false): array
|
|
{
|
|
$query = DB::table($table)->whereNotNull('legacy_id');
|
|
if ($requireCustomer) {
|
|
$query->whereNotNull('customer_id');
|
|
}
|
|
|
|
return $query->pluck('legacy_id')->flip()->all();
|
|
}
|
|
}
|