You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Notification_model extends CI_Model {
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
public function get_notification($id) {
|
|
$this->db->select('n.id, n.status,n.created_at, n.type, u.first_name, u.last_name, u.user_id');
|
|
$this->db->join('user u', 'u.user_id = n.user_id', 'left');
|
|
$this->db->where('n.id', $id);
|
|
$this->db->where('n.status', 0);
|
|
return $this->db->get('notification n')->row();
|
|
}
|
|
|
|
public function get_notifications() {
|
|
$this->db->select('n.id, n.status,n.created_at, n.type, u.first_name, u.last_name, u.user_id');
|
|
$this->db->join('user u', 'u.user_id = n.user_id', 'left');
|
|
$this->db->where('n.status', 0);
|
|
return $this->db->get('notification n')->result_array();
|
|
}
|
|
|
|
public function save_notification($data) {
|
|
$this->db->insert('notification', $data);
|
|
return $this->db->insert_id();
|
|
}
|
|
|
|
public function update_notification($id, $data) {
|
|
foreach ($data as $key => $value) {
|
|
$this->db->set($key, $value);
|
|
}
|
|
$this->db->where('id', $id);
|
|
return $this->db->update('notification');
|
|
}
|
|
|
|
public function delete_notification($id) {
|
|
$this->db->where('id', $id);
|
|
return $this->db->delete('notification');
|
|
}
|
|
|
|
|
|
}
|
|
|