Now can include WHERE clause on showAll() method

This commit is contained in:
2017-09-07 11:21:15 +07:00
parent 041e4dd2dd
commit cf7d5b4c5a
3 changed files with 43 additions and 22 deletions

View File

@@ -26,7 +26,9 @@ class Posts
$table = 'pengumuman';
$valid = $this->post->showAll('valid_at', '<=', $now);
$valid = $this->post->showAll([
['valid_at', '<=', $now]
]);
if ($valid !== false) {
foreach ($valid as $fields) {
$id = $fields['id'];
@@ -35,7 +37,9 @@ class Posts
}
}
$not_valid = $this->post->showAll('valid_at', '>', $now);
$not_valid = $this->post->showAll([
['valid_at', '>', $now]
]);
if ($not_valid !== false) {
foreach ($not_valid as $fields) {
$id = $fields['id'];
@@ -44,7 +48,9 @@ class Posts
}
}
$expired = $this->post->showAll('expired_at', '<', $now);
$expired = $this->post->showAll([
['expired_at', '<', $now]
]);
if ($expired !== false) {
foreach ($expired as $fields) {
$id = $fields['id'];
@@ -58,7 +64,9 @@ class Posts
{
$this->checkValid();
$posts = $this->post->showAll('status', '=', 1);
$posts = $this->post->showAll([
['status', '=', 1]
]);
$url = 'Data/pengumuman.html';
@@ -196,7 +204,7 @@ class Posts
Session::flash('info', 'Data successfuly updated');
Redirect::to('/');
} else {
Session::flash('info', 'Data must not be same');
Session::flash('info', 'Error');
Redirect::to("./$id");
}
}