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
@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
/**
* اتوماسیون ادمین — پیش‌فرض false، can_edit=0 (مالک سوپرادمین).
* value ردیف موجود را تغییر نمی‌دهد.
*/
return new class extends Migration
{
public function up(): void
{
$key = 'enable_automation';
$meta = [
'title_fa' => 'اتوماسیون',
'description' => 'روشن: منوی اتوماسیون در پنل ادمین و اجرای موتور فعال است. خاموش: منو مخفی است و API/کران اجرا نمی‌شود. فقط از سوپرادمین قابل تغییر است.',
'type' => 'switch',
];
$exists = DB::table('settings')->where('key', $key)->exists();
if (! $exists) {
DB::table('settings')->insert([
'key' => $key,
'value' => 'false',
'title_fa' => $meta['title_fa'],
'can_edit' => 0,
'is_active' => 1,
'description' => $meta['description'],
'type' => $meta['type'],
]);
return;
}
DB::table('settings')->where('key', $key)->update([
'title_fa' => $meta['title_fa'],
'description' => $meta['description'],
'type' => $meta['type'],
'can_edit' => 0,
'is_active' => 1,
]);
}
public function down(): void
{
// کلید را حذف نمی‌کنیم
}
};
+8 -1
View File
@@ -403,6 +403,13 @@ WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'charge_notif' LIMIT 1)
-- 'switch'
-- WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'customer_direct_sms' LIMIT 1);
-- [super-admin can_edit=0]
-- INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
-- SELECT 'enable_automation', 'false', 'اتوماسیون', 0, 1,
-- 'روشن: منوی اتوماسیون در پنل ادمین و اجرای موتور فعال است. خاموش: منو مخفی است و API/کران اجرا نمی‌شود. فقط از سوپرادمین قابل تغییر است.',
-- 'switch'
-- WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'enable_automation' LIMIT 1);
-- [super-admin can_edit=0]
-- INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`)
-- SELECT 'enable_conditional_order', 'false', 'سفارش شرطی', 0, 1,
@@ -1257,7 +1264,7 @@ UPDATE `settings` SET `type` = 'switch' WHERE `key` IN (
'profit_gold_api_enabled', 'payping_round_toman', 'payping_strict_failed_withdraw',
'has_page_earn_money', 'has_page_price_trigger', 'has_page_notification', 'has_page_gift_card',
'enable_customer_level_profit', 'charge_notif', 'group_sms', 'customer_special_pricing', 'sms_panel', 'customer_direct_sms',
'enable_conditional_order', 'enable_product_funds',
'enable_conditional_order', 'enable_product_funds', 'enable_automation',
'sms_notif_order_admin', 'sms_notif_order_customer',
'sms_notif_withdraw_admin', 'sms_notif_withdraw_otp', 'sms_notif_login_otp',
'sms_notif_gateway_charge_admin', 'sms_notif_register_customer', 'sms_notif_register_admin',