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

class Model_policyprocedure extends CI_Model {
	function __construct() {
		parent::__construct();
    }

    function getAll($filters = array())
    {
        $this->db->select('a.*, b.category, c.category as parent_category, d.type')
		         ->join('hr__policyprocedure_category b', 'a.category_id = b.id', 'left')
		         ->join('hr__policyprocedure_category c', 'b.parent_id = c.id', 'left')
		         ->join('hr__ref_policyprocedure_type d', 'a.type_id = d.id');

		if(!empty($filters)){
			foreach ($filters as $filter => $value) {
				$this->db->where($filter, $value);
			}
		}

		$this->db->where('a.status', 0)
				 ->where('a.is_delete', 0);
		
		$query = $this->db->get('hr__policypredure a');
    }
}