Removed feature "Administrator can remove posts"
This commit is contained in:
parent
5a00809053
commit
70a4c80143
@ -312,18 +312,4 @@ class Posts
|
|||||||
}
|
}
|
||||||
die();
|
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -241,20 +241,4 @@ class Post extends \Core\Model
|
|||||||
throw new \Exception($e->getMessage(), 444);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -122,18 +122,4 @@
|
|||||||
<button type="submit">Nonaktifkan</button>
|
<button type="submit">Nonaktifkan</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if editor_now.privilage == 1 %}
|
|
||||||
<form method="post">
|
|
||||||
<input type="hidden" name="id" value="{{ post.id }}">
|
|
||||||
|
|
||||||
<!-- Method -->
|
|
||||||
<input type="hidden" name="_method" value="remove">
|
|
||||||
|
|
||||||
<!-- Token -->
|
|
||||||
<input type="hidden" name="_token" value="{{ token }}">
|
|
||||||
|
|
||||||
<button type="submit" style="background-color: red; color: #FFF;">Remove</button>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user