<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Rest extends MY_Controller { 

    function __construct() {
        parent::__construct();
		date_default_timezone_set('Asia/Kolkata');
		error_reporting(0);
    }

	public function test(){
		
        echo md5('m123123');
	}

	public function products_list_api(){
		$prods=$this->db->get('products')->result_array();
        echo json_encode($prods);
	}



	public function banner_api(){
		$data=$this->db->get('banner')->result_array();
        echo json_encode($data);
	}
	public function category_api(){
		$data=$this->db->get('category')->result_array();
        echo json_encode($data);
	}

	public function mcategory_api(){
		$data=$this->db->get('mcategory')->result_array();
        echo json_encode($data);
	}

public function product_detail_api($pid)
{
	$data = $this->db->get_where("products", array("pid" => $pid))->row_array();
	$gallery = $this->db->get_where("pgallery", array("pid" => $pid))->row_array();
	echo json_encode(array("product"=>$data,"gallery"=>$gallery));
}

public function category_product_api($cid)
{
	$data = $this->db->get_where("products", array("cid" => $cid))->result_array();
	echo json_encode($data);
}


}?>