get_ip(); $data['last_ip'] = $this->get_user_agent(); return $data; } /** * If you need to modify payload before edit, overload this function * * @param mixed $data * @return mixed */ protected function _post_edit_processing($data) { return $data; } /** * Allow user to add extra counting condition so user don't have to change main function * * @param mixed $parameters * @return $db */ protected function _custom_counting_conditions(&$db) { return $db; } function get_ip() { if(!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } function get_user_agent() { return $_SERVER['HTTP_USER_AGENT']; } public function get_user ($where) { return $this->_join ('user', 'user_id', $where, []); } public function get_user_paginated ($page, $limit, $where, $order_by, $direction) { return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []); } public function count_paginated ($where) { return count($this->_join ('user', 'user_id', $where, [])); } }