<?php

namespace App\Database\Seeds;

use App\Models\RolePermissionModel;
use CodeIgniter\Database\Seeder;

class RolePermissionSeeder extends Seeder
{
    public function run(): void
    {
        $adminRole = $this->db->table('roles')->where('slug', 'administrator')->get()->getRow();
        if (! $adminRole) {
            return;
        }

        (new RolePermissionModel())->assignAllPermissionsToRole((int) $adminRole->id);
    }
}
