<?php

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

return new class extends Migration
{
    /**
     * Add Block Registry to the admin menu under MTC Only.
     */
    public function up(): void
    {
        if (!DB::table('admin_menu')->where('path', '/admin/blocks')->exists()) {
            DB::table('admin_menu')->insert([
                'sub_id' => 1,
                'title' => 'Block Registry',
                'path' => '/admin/blocks',
                'activePath' => '/admin/blocks',
                'constant' => '',
                'icon' => 'fa fa-cubes',
                'new_window' => 0,
                'order' => 5,
            ]);
        }
    }

    /**
     * Reverse the migration.
     */
    public function down(): void
    {
        DB::table('admin_menu')->where('path', '/admin/blocks')->delete();
    }
};
