Now can reactivate a nonactive category

This commit is contained in:
2017-09-08 15:49:57 +07:00
parent aa3fbd72d5
commit 882e635081
3 changed files with 43 additions and 17 deletions

View File

@@ -209,6 +209,14 @@ class Posts
public function put($args = [])
{
if (isset($args['_addon'])) {
$table = $args['_addon'];
$this->post->update($table, ['status' => 1], $args['id']);
Session::flash('info', 'Data berhasil diaktifkan.');
Redirect::to('/posts/category');
}
$args['content'] = htmlspecialchars($args['content']);
$id = $args['id'];
@@ -259,17 +267,26 @@ class Posts
$id = $args['id'];
if ($this->post->delete($this->table, $id)) {
Session::flash('info', 'Data berhasil di nonaktifkan');
if ($this->table = 'kategori') {
Redirect::to('/posts/category');
} elseif ($this->table = 'pengumuman') {
Redirect::to('/');
}
if ($this->table == 'kategori') {
$delete = $this->post->delete($this->table, $id, 0);
} else {
$delete = $this->post->delete($this->table, $id);
}
if ($delete == true) {
$info = 'Data berhasil dinonaktifkan.';
} else {
$info = 'Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat.';
}
// Return the $table back to default
$this->table = 'pengumuman';
Session::flash('info', $info);
if ($this->table = 'kategori') {
Redirect::to('/posts/category');
} elseif ($this->table = 'pengumuman') {
Redirect::to('/');
}
}
}