コントローラーでクエリを実行していましたが、モデルで実行する必要があることに気付きました。
これは私がコントローラーに持っているコードです
$this->db->where('page', 'your-secret-skill');
$this->data['articles'] = $this->article_m->get();
これは、コア モデルにある get メソッドです。
public function get($id = NULL, $single = FALSE){
if ($id != NULL) {
$filter = $this->_primary_filter;
$id = $filter($id);
$this->db->where($this->_primary_key, $id);
$method = 'row';
}
elseif($single == TRUE) {
$method = 'row';
}
else {
$method = 'result';
}
if (!count($this->db->ar_orderby)) {
$this->db->order_by($this->_order_by);
}
return $this->db->get($this->_table_name)->$method();
}
これについてどうすれば記事モデルでクエリを実行し、コントローラーでそれをロードできますか?