Added error handler

This commit is contained in:
2017-09-07 16:11:54 +07:00
parent 796148a532
commit 23622bc5a8
14 changed files with 204 additions and 56 deletions

View File

@@ -30,7 +30,7 @@ class Posts
['valid_at', '<=', $now],
['status', '!=', 3]
]);
if ($valid !== false) {
if ($valid) {
foreach ($valid as $fields) {
$id = $fields['id'];
@@ -42,7 +42,7 @@ class Posts
['valid_at', '>', $now],
['status', '!=', 3]
]);
if ($not_valid !== false) {
if ($not_valid) {
foreach ($not_valid as $fields) {
$id = $fields['id'];
@@ -54,7 +54,7 @@ class Posts
['expired_at', '<', $now],
['status', '!=', 3]
]);
if ($expired !== false) {
if ($expired) {
foreach ($expired as $fields) {
$id = $fields['id'];
@@ -108,7 +108,7 @@ class Posts
'token' => Token::generate()
]);
} else {
Redirect::to('/');
throw new \Exception("Page not found", 404);
}
}
@@ -148,7 +148,7 @@ class Posts
);
}
} else {
Redirect::to('/');
throw new \Exception("Page not found", 404);
}
}
@@ -162,7 +162,7 @@ class Posts
'token' => Token::generate()
]);
} else {
Redirect::to('/');
throw new \Exception("Page not found", 404);
}
}