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

class Departments_model extends CI_Model {

    // private $table = 'kns1_departments';
public function count_all()
{
    return $this->db->count_all('kns1_departments'); // table name
}
    public function get_all($limit = NULL, $offset = NULL)
    {
        $this->db->order_by('id', 'ASC');
        $query = $this->db->get('kns1_departments', $limit, $offset);
        return $query->result();
    }

    public function insert($data)
    {

        $this->db->insert('kns1_departments', $options);
        return $this->db->insert_id();
    }

    public function update($id, $options)
    {
        $this->db->where('id', $id);
        $this->db->update('kns1_departments', $options);
        return $id;
    }

    public function delete($id)
    {
        $this->db->where('id', $id);
        $this->db->delete('kns1_departments');
        return $this->db->affected_rows();
    }
  
}
