<?php

namespace Database\Seeders;

use App\Models\Permission;
use App\Models\Role;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class RoleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $role = Role::query()->create([
            'id' => 1,
            'name' => 'super-admin',
            'name_fa' => 'ادمین',
            'guard_name' => 'web',
            'created_at' => now(),
            'updated_at' => now()
        ]);

        $role->givePermissionTo(Permission::all());
        User::query()->where('username', '=', 'witel')->first()->assignRole('super-admin');
    }
}
