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
{
// کلید را حذف نمی‌کنیم
}
};