Administrator can remove posts

This commit is contained in:
2017-09-09 14:07:53 +07:00
parent 086edebd41
commit 94d4a76ec6
4 changed files with 52 additions and 4 deletions

View File

@@ -154,7 +154,9 @@ class Posts
['id', '=', $editor]
], $table);
$editor_now = Session::get('userid');
$editor_now = $this->model->showAll([
['id', '=', Session::get('userid')]
], $table);
$date = new \DateTime();
$timestamp = $date->format("Y-m-d");
@@ -310,4 +312,18 @@ class Posts
}
die();
}
public function remove($args = [])
{
$id = $args['id'];
if ($this->model->remove($id) == true) {
$info = 'Data berhasil dihapus';
} else {
$info = 'Terjadi kesalahan. Silahkan coba lagi dalam beberapa saat.';
}
Session::flash('info', $info);
Redirect::to('/');
die();
}
}