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

@@ -241,4 +241,20 @@ class Post extends \Core\Model
throw new \Exception($e->getMessage(), 444);
}
}
public function remove($id) {
try {
$db = static::connectDB();
$sql = "DELETE FROM pengumuman WHERE id = ?";
$query = $db->prepare($sql);
$query->bindValue(1, $id);
$query->execute();
return true;
} catch (PDOException $e) {
throw new \Exception($e->getMessage(), 444);
}
}
}