/** * Preview an existing post. * * @param PostRepositoryInterface $posts * @param $id * @return \Illuminate\View\View */ public function preview(PostRepositoryInterface $posts, $id) { if (!($post = $posts->findByStrId($id))) { abort(404); } $this->dispatch(new AddPostsBreadcrumb()); $this->dispatch(new MakePreviewResponse($post)); if ($category = $post->getCategory()) { $this->dispatch(new AddCategoryBreadcrumb($category)); } $this->dispatch(new AddPostBreadcrumb($post)); return $post->getResponse(); }
/** * Preview an existing post. * * @param PostRepositoryInterface $posts * @param $id * @return \Illuminate\View\View */ public function preview(PostRepositoryInterface $posts, $id) { if (!($post = $posts->findByStrId($id))) { abort(404); } $this->authorizer->authorize($post); $this->loader->load($post); $this->response->make($post); $this->http->cache($post); $this->dispatch(new AddPostsBreadcrumb()); if ($category = $post->getCategory()) { $this->dispatch(new AddCategoryBreadcrumb($category)); } $this->dispatch(new AddPostBreadcrumb($post)); return $post->getResponse(); }