App\Http\Controllers\Admin\ActionController::republish PHP Method

republish() public method

public republish ( )
    public function republish()
    {
        @($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 == 2 || $post->post_state == 4 || $post->post_state == 8 || $post->post_state == 9)) {
                $response = $this->publishPostToFacebook($post);
            }
        }
        echo json_encode($response);
    }