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

class Model_Cat_planta extends CI_Model{

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

	function all(){
		$query = $this->db->get('cat_planta');
		return $query->result();
	}

	function all_filtered($campo,$valor){
		$this->db->like($campo,$valor);
		$query = $this->db->get('cat_planta');
		return $query->result();
	}

	function find($pk){
		$this->db->where('pk_cat_planta',$pk);
		return $this->db->get('cat_planta')->row();
	}

	function insert($registro){
		$this->db->set($registro);
		$this->db->insert('cat_planta');
	}

	function update($registro){
		$this->db->set($registro);
		$this->db->where('pk_cat_planta',$registro['pk_cat_planta']);
		$this->db->update('cat_planta');
	}
	
	function update_status ($pk,$status){
		$registro = array("status" => $status);
		$this->db->where('pk_cat_planta',$pk);
		$this->db->update('cat_planta',$registro);
	}

}