input->post(); $this->id_umkm = $id_umkm; $this->produk = $post["produk"]; $this->deskripsi = $post["deskripsi"]; $this->foto_produk = "default.png"; return $this->db->insert($this->_table, $this); } public function getProdukByUmkmId($id_umkm){ $this->db->where('id_umkm', $id_umkm); $this->db->order_by('produk', 'DESC'); return $produk = $this->db->get($this->_table)->result(); } public function getProdukById($id_produk){ $this->db->where('id_produk', $id_produk); return $produk = $this->db->get($this->_table)->row(); } public function getLastProdukByIdUmkm($id_umkm){ $this->db->where('id_umkm', $id_umkm); $this->db->order_by('id_produk', 'DESC'); return $umkm = $this->db->get($this->_table)->row(); } public function setFirstImage($id_produk,$foto_produk) { $this->foto_produk = $foto_produk; return $this->db->update($this->_table, $this, array('id_produk' => $id_produk)); } public function delete($id_produk) { return $this->db->delete($this->_table, array("id_produk" => $id_produk)); } }