public function onStart() { $slug = $this->param('slug'); $this['post'] = Post::where('slug', '=', $slug)->isPublished()->first(); if (!$this['post']) { return Redirect::to('/404'); } $this->page->settings['title'] = $this["post"]->title; }
protected function listPosts() { $posts = NewsPost::listFrontEnd(['page' => $this->property('pageNumber'), 'sort' => $this->property('sortOrder'), 'perPage' => $this->property('postsPerPage')]); return $posts; }
public function onStart() { $this['posts'] = Post::isPublished()->orderBy('published_at', 'desc')->take(2)->get(); }
protected function loadPost() { $slug = $this->property('slug'); $post = NewsPost::isPublished()->where('slug', $slug)->first(); return $post; }