protected function is_unique($field, $value, $id) { $where = [$field => $value]; if ($id) { $where[] = "id != {$id}"; } return !$this->db->get_where($this->table, $where)->row_array(); }
public function get_by_id($id) { return $this->db->get_where($this->table, ['id' => $id])->row_array(); }