25 lines
602 B
PHP
25 lines
602 B
PHP
<?php
|
|
|
|
namespace App\Services\Automation;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class AutomationEvents
|
|
{
|
|
public static function fire(string $event, int $customerId): void
|
|
{
|
|
if ($customerId <= 0 || $event === '') {
|
|
return;
|
|
}
|
|
try {
|
|
app(AutomationEngine::class)->onCustomerEvent($event, $customerId);
|
|
} catch (\Throwable $e) {
|
|
Log::warning('Automation event failed', [
|
|
'event' => $event,
|
|
'customer_id' => $customerId,
|
|
'error' => $e->getMessage(),
|
|
]);
|
|
}
|
|
}
|
|
}
|