db = \Config\Database::connect(); $this->request = \Config\Services::request(); } protected $table = 'demam_berdarah'; protected $primaryKey = 'id'; protected $returnType = 'object'; protected $allowedFields = ['id', 'Tahun', 'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember']; public function getDarah() { return $this->orderBy('id', 'DESC')->get(); } public function getDarah2() { return $this->orderBy('Tahun', 'DESC')->get(); } public function getDarah3() { return $this->orderBy('id', 'DESC')->limit(1)->get(); } public function insert_darah($data) { return $this->db->table($this->table)->insert($data); } public function getById($id) { return $this->where(['id' => $id])->get(); } }