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

class CategoryModel extends MY_Model
{

    public $ca_parent;
    public $ca_title;
    public $ca_slug;
    public $ca_order;
    public $ca_hide;
    public $ca_trend;
    public $ca_hide_section;

    public function __construct()
    {
        parent::__construct();
        $this->load->database();
    }

    public function findAll() {
        return $this->db->get('news_section')->result();
    }

    public function findByName($name) {
        $query = $this->db->where('category_name', $name)
        ->get('news_section');
        return $query->num_rows() ? $query->row()->category_code : 12;

    }
}
