From 699515ad197ac751c1dcf316016e8bf0d2761590 Mon Sep 17 00:00:00 2001 From: totoprayogo1916 Date: Wed, 16 Aug 2023 16:28:32 +0700 Subject: [PATCH] insert config --- donjo-app/controllers/Hom_desa.php | 5 ++++- donjo-app/models/Config.php | 10 ++++++++++ donjo-app/models/Config_model.php | 10 ---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/donjo-app/controllers/Hom_desa.php b/donjo-app/controllers/Hom_desa.php index 24abcda2b..b8c921cc9 100644 --- a/donjo-app/controllers/Hom_desa.php +++ b/donjo-app/controllers/Hom_desa.php @@ -41,7 +41,10 @@ public function about() public function insert() { - $this->config_model->insert(); + $configModel = new Config(); + + $configModel->insert($_POST); + redirect('hom_desa'); } diff --git a/donjo-app/models/Config.php b/donjo-app/models/Config.php index 80de7168d..a837130f5 100644 --- a/donjo-app/models/Config.php +++ b/donjo-app/models/Config.php @@ -8,6 +8,16 @@ class Config extends Model { protected $table = 'config'; + public function insert($data) + { + $outp = $this->db->insert($this->table, $data); + if ($outp) { + $_SESSION['success'] = 1; + } else { + $_SESSION['success'] = -1; + } + } + public function get_data(bool $return_array = false) { $query = $this->db->get($this->table); diff --git a/donjo-app/models/Config_model.php b/donjo-app/models/Config_model.php index bb34702d5..69442ffd5 100644 --- a/donjo-app/models/Config_model.php +++ b/donjo-app/models/Config_model.php @@ -56,16 +56,6 @@ public function initsurat() } } - public function insert() - { - $outp = $this->db->insert('config', $_POST); - if ($outp) { - $_SESSION['success'] = 1; - } else { - $_SESSION['success'] = -1; - } - } - public function update($id = 0) { $data = $_POST;