protected function getPageList() { $mainMenu = Page::with(['translation', 'menuPositions' => function ($query) { $query->wherePivot('menu_position_id', 2); }])->parent()->get(); $pageList = Page::makePageList($mainMenu); return $pageList; }
/** * 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')); }