<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Role_model extends CI_Model {

    public function __construct() {
        parent::__construct();
    }

    public function get_all() {
        return $this->db->get('kns1_roles')->result();
    }

    public function get_by_id($id) {
        return $this->db->get_where('kns1_roles', ['id' => $id])->row();
    }

    public function create($data) {
        return $this->db->insert('kns1_roles', $data);
    }
    // Update Role
public function update($id, $data) {
    $this->db->where('id', $id)->update('kns1_roles', $data);
    return $this->db->affected_rows();
}

// Delete Role
public function delete($id) {
    $this->db->delete('kns1_roles', ['id' => $id]);
    return $this->db->affected_rows();
}
}
