Airship\Cabin\Bridge\Blueprint\Blog::getBlogPostVersions PHP Method

getBlogPostVersions() public method

public getBlogPostVersions ( integer $postId ) : array
$postId integer
return array
    public function getBlogPostVersions(int $postId) : array
    {
        $posts = $this->db->run(\Airship\queryString('blog.posts.list_versions'), $postId);
        if (empty($posts)) {
            return [];
        }
        return $posts;
    }

Usage Example

Example #1
0
 /**
  * View the history for a blog post.
  *
  * @param string $postID
  *
  * @route blog/post/history/{id}
  */
 public function postHistory(string $postID = '')
 {
     $blog = $this->blog->getBlogPostById((int) $postID);
     if (!$blog || !$this->can('read')) {
         \Airship\redirect($this->airship_cabin_prefix . '/blog/post');
     }
     $this->lens('blog/post_history', ['active_link' => 'bridge-link-blog-posts', 'blog' => $blog, 'history' => $this->blog->getBlogPostVersions((int) $postID)]);
 }