<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        $exists = DB::table('admin_menu_terminals')->where('type', 'home')->exists();

        if (!$exists) {
            DB::table('admin_menu_terminals')->insert([
                'type' => 'home',
                'name' => '官网前端',
                'description' => '官网前端导航菜单（由应用触发）',
                'sort' => 3,
                'status' => 1,
                'create_time' => now(),
                'update_time' => now(),
            ]);
        }
    }

    public function down(): void
    {
        DB::table('admin_menu_terminals')->where('type', 'home')->delete();
    }
};
