public function deny()
{
@($id = (int) \Route::input('id'));
$response = ['state' => 'error', 'message' => 'Something wrong.'];
if (!empty($id) && $id > 0) {
$post = \DB::table('post')->where('id', $id)->first();
if (count($post) > 0 && ($post->post_state == 0 || $post->post_state == 5)) {
try {
\DB::table('post')->where('id', $id)->update(['post_state' => 4]);
$response = ['state' => 'success', 'message' => 'Update success.'];
} catch (Exception $e) {
$response = ['state' => 'failed', 'message' => 'Update failed.'];
}
}
}
echo json_encode($response);
}