<?php 
class Service_model extends CI_Model {
	public function _consruct(){
		parent::_construct();
	}

public function add_service($serviceData){
		$qry = $this->db->insert('services',$serviceData);

		if ($this->db->trans_status() === TRUE)
		{
			$this->db->trans_commit();
			return TRUE;
		}else
		{
			$this->db->trans_rollback();
			return false;
		}
	}

public function getserviceData($service_id='',$view=''){

		$cond  = (!empty($view))?" status IN ($view) ":" status != '2' ";
		$cond .= (!empty($service_id))?" AND id='$service_id' ":"";

		$serviceData = $this->db->query("SELECT * FROM services WHERE $cond Order by id DESC");

		if(!empty($serviceData)){
			return (empty($service_id))?$serviceData->result():$serviceData->row();
		}
		return 0;
	}

public function update_service($id,$serviceData)
	{


		$this->db->where('id',$id);
		$qry = $this->db->update('services',$serviceData);
		return true;


	}

	function changeStatus($service_id = '', $status = '0'){

 		if(empty($service_id)){
 			return 0;
 		}
 		$status = $this->db->update('services',array('status'=>$status),array('id'=>$service_id));
 		return $status;
 	}





}