feat(settings): enable_automation gate; reject stale montzar quote jumps

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-24 16:15:52 +03:30
co-authored by Cursor
parent b28a98938e
commit 352bb9976d
9 changed files with 212 additions and 18 deletions
@@ -6,6 +6,7 @@ use App\Models\Automation;
use App\Models\AutomationDelayedJob;
use App\Models\Customer;
use App\Models\Product;
use App\Services\ConfigService;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
@@ -19,12 +20,18 @@ class AutomationEngine
public function runDue(): void
{
if (! app(ConfigService::class)->isAutomationEnabled()) {
return;
}
$this->runSchedule();
$this->processDelayedJobs();
}
public function onCustomerEvent(string $event, int $customerId): void
{
if (! app(ConfigService::class)->isAutomationEnabled()) {
return;
}
$customer = Customer::query()->find($customerId);
if (! $customer || (int) $customer->type !== 2 || $customer->is_archive) {
return;
@@ -52,6 +59,9 @@ class AutomationEngine
public function evaluatePriceMove(array $payload = []): void
{
if (! app(ConfigService::class)->isAutomationEnabled()) {
return;
}
$rows = Automation::query()
->where('is_active', true)
->where('trigger_type', AutomationCatalog::TRIGGER_PRICE)