Added function to deactivate post

This commit is contained in:
2017-09-05 10:53:03 +07:00
parent 61060dd393
commit 1381593163
4 changed files with 38 additions and 8 deletions

View File

@@ -169,11 +169,13 @@ abstract class Model
try {
$db = static::connectDB();
$sql = "DELETE FROM {$table} WHERE id = ?";
$sql = "UPDATE {$table} SET status = ? WHERE id = ?";
$query = $db->prepare($sql);
$query->bindValue(1, 0);
$query->bindValue(2, $id);
if ($query->execute([$id])) {
if ($query->execute()) {
return true;
}
return false;