<?php

class Feed_model extends CI_Model
{
	
	public function get_from_cat($type, $id) {
			$type == 'parent_category' ? $category = 'parent_category' : $category = 'category';
			$this->db->select('torrents.id, torrents.name, torrents.seed, torrents.leech, torrents.publish_date, torrents.size, torrents.category_slug, categories.name as category_name, categories.id as category_id');
			$this->db->where($category, $id);
			$this->db->where('state',0);
			$this->db->from('torrents');
			$this->db->join('categories','torrents.'.$category.' = categories.id');
			$this->db->order_by('torrents.id','desc')->limit(100);
			
			return $this->db->get()->result();
	}

}