feat(settings): enable_automation gate; reject stale montzar quote jumps
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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
|
||||
{
|
||||
// کلید را حذف نمیکنیم
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user