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
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\Markable;
|
||||
use App\Support\ServiceExpirySync;
|
||||
use App\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -25,6 +26,12 @@ class Service extends Model
|
||||
$service->type = Product::query()->where('id', $service->product_id)->value('product_type');
|
||||
}
|
||||
});
|
||||
|
||||
static::saved(function (Service $service) {
|
||||
if ($service->wasRecentlyCreated || $service->wasChanged(['expires_at', 'vm_id'])) {
|
||||
ServiceExpirySync::toVmware($service);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected $table = 'services';
|
||||
|
||||
Reference in New Issue
Block a user