feat(billing): renewals, coupons, VAT numbering, billing cycles and invoice payment tracking
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
ea9a53f742
commit
25f23d541e
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\ModuleVmware;
|
||||
use App\Models\Service;
|
||||
|
||||
final class ServiceExpirySync
|
||||
{
|
||||
public static function toVmware(Service $service): int
|
||||
{
|
||||
if (! $service->vm_id || ! $service->expires_at) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$timestamp = $service->expires_at->timestamp;
|
||||
|
||||
return ModuleVmware::query()
|
||||
->whereKey($service->vm_id)
|
||||
->where(fn ($query) => $query->whereNull('next_due_date')->orWhere('next_due_date', '!=', $timestamp))
|
||||
->update(['next_due_date' => $timestamp]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user