/** * @param PageTranslation $page * @param PageRepositoryInterface $pages * @return mixed */ public function renderPageDetail(PageTranslation $page, PageRepositoryInterface $pages) { $page = $page->page; $page->load($pages->relations()); $this->seo->setEntity($page); return $this->theme->render('pages.show', ['page' => $page]); }
/** * @param Page $page * @param PageRepositoryInterface $pages * @return Page */ public function show(Page $page, PageRepositoryInterface $pages) { $page->load($this->relations()); //make sure one cannot select itself as a subpage $but = new Collection([$page]); if ($page->parent) { $but->push($page->parent); } //make sure one cannot select a page B to add as a subpage to page A when page A is already a child of page B $availablePages = $pages->with(['translations'])->orphans()->but($but)->get(); $page->availablePages = $availablePages; $this->prepareMedia($page, ['images', 'videos', 'infographics', 'files']); return $page; }