Skip to content

Commit

Permalink
update_()
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 committed Aug 16, 2023
1 parent 699515a commit b45d3c7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 30 deletions.
10 changes: 8 additions & 2 deletions donjo-app/controllers/Hom_desa.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,19 @@ public function ajax_wilayah_maps()

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

$configModel->update_(1, $_POST);

redirect('hom_desa');
}

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

$configModel->update_(1, $_POST);

redirect('hom_desa');
}

Expand Down
12 changes: 12 additions & 0 deletions donjo-app/models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ public function insert($data)
}
}

public function update_(int $id, $data)
{
$this->db->where('id', $id);
$outp = $this->db->update($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
28 changes: 0 additions & 28 deletions donjo-app/models/Config_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,6 @@ public function update($id = 0)
}
}

public function update_kantor()
{
$data = $_POST;
$id = '1';
$this->db->where('id', $id);
$outp = $this->db->update('config', $data);

if ($outp) {
$_SESSION['success'] = 1;
} else {
$_SESSION['success'] = -1;
}
}

public function update_wilayah()
{
$data = $_POST;
$id = '1';
$this->db->where('id', $id);
$outp = $this->db->update('config', $data);

if ($outp) {
$_SESSION['success'] = 1;
} else {
$_SESSION['success'] = -1;
}
}

public function kosong_pend()
{
$a = 'TRUNCATE tweb_wil_clusterdesa';
Expand Down

0 comments on commit b45d3c7

Please sign in to comment.