* @param string $bookSlug
* @param string $pageSlug
* @return Response
+ * @throws NotFoundException
*/
public function show($bookSlug, $pageSlug)
{
$page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
} catch (NotFoundException $e) {
$page = $this->entityRepo->getPageByOldSlug($pageSlug, $bookSlug);
- if ($page === null) abort(404);
+ if ($page === null) throw $e;
return redirect($page->getUrl());
}
$pageNav = $this->entityRepo->getPageNav($page->html);
// check if the comment's are enabled
- $areCommentsEnabled = !setting('app-disable-comments');
- if ($areCommentsEnabled) {
- $page->load(['comments.createdBy']);
+ $commentsEnabled = !setting('app-disable-comments');
+ if ($commentsEnabled) {
+ $page->load(['comments.createdBy']);
}
Views::add($page);
$this->setPageTitle($page->getShortName());
return view('pages/show', [
'page' => $page,'book' => $page->book,
- 'current' => $page, 'sidebarTree' => $sidebarTree,
- 'commentsEnabled' => $areCommentsEnabled,
- 'pageNav' => $pageNav]);
+ 'current' => $page,
+ 'sidebarTree' => $sidebarTree,
+ 'commentsEnabled' => $commentsEnabled,
+ 'pageNav' => $pageNav
+ ]);
}
/**