protected function listPosts() { /* * List all the posts */ $posts = BlogPost::leftJoin('vdomah_blogviews_views as pv', 'pv.post_id', '=', 'rainlab_blog_posts.id')->orderBy('views', 'DESC')->limit($this->postsLimit)->get(); $posts->each(function ($post) { $post->setUrl($this->postPage, $this->controller); }); return $posts; }