<?php

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

return new class extends Migration
{
    public function up(): void
    {
        $maxOrder = DB::table('admin_menu')->max('order') ?? 0;

        DB::table('admin_menu')->insert([
            'title'      => 'Referrals',
            'path'       => '/admin/referrals',
            'activePath' => '/admin/referrals',
            'icon'       => 'fas fa-user-friends',
            'order'      => $maxOrder + 1,
            'sub_id'     => 0,
            'new_window' => 0,
        ]);
    }

    public function down(): void
    {
        DB::table('admin_menu')->where('path', '/admin/referrals')->delete();
    }
};
