<?php
namespace App\Models;
use CodeIgniter\Model;

class RolePermissionModel extends Model
{
    protected $table         = 'role_permissions';
    protected $primaryKey    = 'id';
    protected $allowedFields  = ['role_id','permission','created_at','updated_at','deleted_at'];

    public function getForRole(int $roleId): array
    {
        return array_column($this->where('role_id', $roleId)->findAll(), 'permission');
    }
}
