<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

use App\Models\Role;
use Illuminate\Support\Str;

return new class () extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        $roles = Role::all()
            ->filter(function ($role) {
                return Str::startsWith(Str::lower($role->name), ['dl.']);
            });

        foreach ($roles as $role) {
            $role->removeRole();
        }
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        //
    }
};
