Skip to content

Commit

Permalink
insert config
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 committed Aug 16, 2023
1 parent d1ec3c5 commit 699515a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
5 changes: 4 additions & 1 deletion donjo-app/controllers/Hom_desa.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ public function about()

public function insert()
{
$this->config_model->insert();
$configModel = new Config();

$configModel->insert($_POST);

redirect('hom_desa');
}

Expand Down
10 changes: 10 additions & 0 deletions donjo-app/models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 0 additions & 10 deletions donjo-app/models/Config_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 699515a

Please sign in to comment.