update email template
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Integrations\Whmcs\Support;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Resolves a WHMCS `tblorders.id` to the matching local `orders.id` via `orders.legacy_id`.
|
||||
* Orders must be synced (whmcs:sync-orders) before invoices for this to find anything.
|
||||
*/
|
||||
class OrderIdResolver
|
||||
{
|
||||
/** @var array<int, int>|null legacy order id => local order id */
|
||||
private static ?array $map = null;
|
||||
|
||||
public function resolve(int $whmcsOrderId): ?int
|
||||
{
|
||||
self::$map ??= DB::table('orders')->whereNotNull('legacy_id')->pluck('id', 'legacy_id')->all();
|
||||
|
||||
return self::$map[$whmcsOrderId] ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user