CI =& get_instance(); // Load Model $this->CI->load->model('Notification_model'); } public function setNotificationCookie($user_id) { Cookie::create([ 'name' => 'notif', 'value' => json_encode(array( 'user_id'=> $user_id, )), 'expire' => '7200', //2days 'prefix' => $this->CI->config->item('sess_cookie_name').'_', // 'domain' => 'localhost' ]); } public function getNotificationCookie() { $cookieData = json_decode(get_cookie(self::COOKIE_KEY)); return $cookieData; } public function deleteNotificationCookie() { // Delete registration cookie Cookie::delete(self::COOKIE_KEY); } public function getNotifications() { return $this->CI->Notification_model->get_notifications(); } public function updateNotification(int $id, array $data) { return $this->CI->Notification_model->update_notification($id, $data); } }