Last active
August 29, 2015 14:20
-
-
Save hedii/f9e76f891f86cb7b84d5 to your computer and use it in GitHub Desktop.
Revisions
-
hedii renamed this gist
May 11, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
hedii created this gist
May 11, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,83 @@ <?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * MY_Model class. * * @extends CI_model */ class MY_Model extends CI_model { /** * create function. * * @access public * @param array $data (default: array()) * @return bool */ public function create($data = array()) { return $this->db->insert($this->table, $data); } /** * get function. * * @access public * @param array $where (default: array()) * @return mixed */ public function get($where = array()) { $this->db->from($this->table); $this->db->where($where); return $this->db->get()->result(); } /** * update function. * * @access public * @param array $where (default: array()) * @param array $data (default: array()) * @return bool */ public function update($where = array(), $data = array()) { $this->db->where($where); return (bool) $this->db->update($this->table, $value); } /** * delete function. * * @access public * @param array $where (default: array()) * @return bool */ public function delete($where = array()) { $this->db->from($this->table); $this->db->where($where); return (bool) $this->db->delete(); } /** * count function. * * @access public * @param array $where (default: array()) * @return int */ public function count($where = array()) { $this->db->from($this->table); $this->db->where($where); return (int) $this->count_all_results(); } }