public function show($slug) { $page = Page::with('translation', 'banners.translation')->slug($slug)->firstOrFail(); if (!isset($page->layout)) { abort(404, 'layout not found'); } $method = '_' . $page->layout; if (method_exists($this, $method)) { $this->{$method}(); } return view('frontend/pages/' . $page->layout, compact('page'))->with('articles', $this->articles); }
protected function updatePageOrder(Page $page, Request $request) { if ($request->has('order', 'orderPage')) { try { $page->updateOrder($request->input('order'), $request->input('orderPage')); } catch (MoveNotPossibleException $e) { return back()->withInput()->withErrors(['error' => 'Cannot make a page a child of itself.']); } } }
/** * Show the form for editing the specified resource. * * @param int $id * * @return \Illuminate\Http\Response */ public function edit($id) { $banner = Banner::findOrFail($id); $pageList = Page::makePageList(Page::with('translation', 'menuPositions')->get()); foreach (LaravelLocalization::getSupportedLocales() as $localCode => $properties) { $translation[$localCode] = BannerTranslation::ByBanner($id)->byLang($localCode)->first(); } return view('backend.banner.edit', compact('banner', 'translation', 'pageList')); }