D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
ci_panel
/
application
/
models
/
Filename :
Notification_model.php
back
Copy
<?php class Notification_model extends CI_model{ public function get_notification($param = array()) { # code... // for pagination if(isset($param['limit']) && isset($param['offset'])){ $this->db->limit($param['limit'], $param['offset']); } $query = $this->db->get('tbl_notice'); $notification = $query->result_array(); return $notification; } public function add_notice($formArray) { # code... $this->db->insert('tbl_notice', $formArray); return $this->db->insert_id(); //this will return last inserted id } public function getNotificationCounts() { # code... $count = $this->db->count_all_results('tbl_notice'); return $count; } public function getNoti($id) { # code... $this->db->where('file_id', $id); $noti = $this->db->get('tbl_notice')->result_array(); return $noti; } public function deleteNotification($id) { # code... $this->db->where('file_id', $id); $this->db->delete('tbl_notice'); } public function editNotification($id, $formArray) { # code... $this->db->where('file_id', $id); $this->db->update('tbl_notice', $formArray); // echo $this->db->last_query(); } // ==============Models for front-end start=============== // public function LatestNotice() { # code... $this->db->order_by('file_id', 'desc'); $this->db->limit(5); $latestNotice = $this->db->get('tbl_notice')->result_array(); return $latestNotice; } }