fix bug 2
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! DB::table('settings')->where('key', 'support_messengers')->exists()) {
|
||||
DB::table('settings')->insert([
|
||||
'key' => 'support_messengers',
|
||||
'value' => '',
|
||||
'title_fa' => 'پیامرسانهای پشتیبانی',
|
||||
'type' => 'longtext',
|
||||
'can_edit' => 1,
|
||||
'is_active' => 1,
|
||||
'description' => 'لیست JSON پیامرسانها — هر مورد: messenger + id',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
$current = trim((string) DB::table('settings')->where('key', 'support_messengers')->value('value'));
|
||||
if ($current !== '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$legacyType = trim((string) DB::table('settings')->where('key', 'support_messenger')->value('value'));
|
||||
$legacyId = trim((string) DB::table('settings')->where('key', 'support_messenger_id')->value('value'));
|
||||
|
||||
if ($legacyId === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$messenger = $legacyType !== '' ? $legacyType : 'bale';
|
||||
$payload = json_encode([
|
||||
['messenger' => $messenger, 'id' => $legacyId],
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
|
||||
DB::table('settings')->where('key', 'support_messengers')->update([
|
||||
'value' => $payload,
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('settings')->where('key', 'support_messengers')->delete();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! DB::table('settings')->where('key', 'tracking_systems')->exists()) {
|
||||
DB::table('settings')->insert([
|
||||
'key' => 'tracking_systems',
|
||||
'value' => '[]',
|
||||
'title_fa' => 'سامانههای ردیابی',
|
||||
'type' => 'longtext',
|
||||
'can_edit' => 0,
|
||||
'is_active' => 1,
|
||||
'description' => 'JSON لیست سامانههای آنالیتیکس/ردیابی — فقط دیپلوی',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('settings')->where('key', 'tracking_systems')->delete();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user