public function index() { $this->vars['postsTotal'] = Post::count(); $this->vars['postsPublished'] = Post::isPublished()->count(); $this->vars['postsDrafts'] = $this->vars['postsTotal'] - $this->vars['postsPublished']; $this->asExtension('ListController')->index(); }
protected function loadPost() { $slug = $this->property('slug'); $post = BlogPost::isPublished()->where('slug', $slug)->first(); /* * Add a "url" helper attribute for linking to each category */ if ($post && $post->categories->count()) { $post->categories->each(function ($category) { $category->setUrl($this->categoryPage, $this->controller); }); } return $post; }