Now can reactivate a nonactive category
This commit is contained in:
@@ -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('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user