public function getSitemapForIndexByTemplateName($templateName) { $template = Template::where('name', 'Nieuwsbericht')->firstOrFail(); $sitemap = Sitemap::with(['translation', 'template', 'user'])->where('template_id', $template->id)->orderBy('created_at', 'asc')->get(); return $sitemap; }
public function indexHome(Request $request) { //$references = Sitemap::with([ // 'references.componentsTest', // 'references.translation'])->where('id',36); //dc($references->get()); //return "view"; $this->sitemap->initWebPage(); $navigation = $this->sitemap->getWebpageNavigation(); $sitemap = $this->sitemap->getWebpageContent(); //dc($navigation[1]); $breadcrumb = $this->sitemap->getBreadcrumbArray(); $breadcrumbHTML = $this->sitemap->getBreadcrumbHTML(); //dc($breadcrumbHTML); $sitemapList = $this->sitemap->getWebPageSitemapList(); $pagination = $sitemapList instanceof LengthAwarePaginator; //dc($sitemapList); if (!is_null($sitemapList)) { foreach ($sitemapList as $key => $sitemapListItem) { //if ($key == 0){ $this->sitemap->groupMediaTranslationCollectionByFieldName($sitemapListItem->translation); //} } } $this->sitemap->groupMediaTranslationCollectionByFieldName($sitemap->translation); //dc($sitemap); //$template = Sitemap::with('template')->findOrFail($id)->template; //dc($sitemap->references); //dc($sitemapList); //dc($sitemapList[0]->translation->media['intro']); //foreach ($sitemapList[0]->translation->media['intro'] as $key => $image){ // dc($key); //} //$this->sitemap->groupMediaCollectionByFieldName($sitemap->translations); //dc($test); //dc($navigation[0]); foreach ($navigation[0] as $key => $nav) { // dc($nav->translation->name.' - '.$nav->selected.' - '.$nav->hasChildren); } return view('index', compact('sitemap', 'navigation', 'breadcrumb', 'breadcrumbHTML', 'sitemapList', 'pagination')); //dc($breadcrumb[0]->template->name); $test = ''; foreach ($breadcrumb as $key => $breadcrumbItem) { // $test .= ($breadcrumbItem->translation->name.' - '); } dc($breadcrumb); dc($sitemap->translation->name); /* foreach($navigation as $key => $nav){ foreach($nav as $key1 => $nav1){ dc($nav1->translation->name.' - '.$nav1->selected.' - '.$nav1->no_sitemap_parents); //dc($nav1->selected); //dc($nav1->no_sitemap_parents); } dc('end'); } */ return "view"; //dc($test); //dc($breadcrumb); //dc($navigation); //dc($sitemapList); /* * GOED $ */ //$navigation[0][0]->setAttribute('selected',true); //dc($navigation[0][1]->getAttributes()); //dc($navigation[0][1]); //dc($navigation[0][1]->selected); /* foreach ($navigation[2] as $key => $nav){ dc($nav->translation->name); dc($nav->selected); dc($nav->no_sitemap_parents); } foreach ($navigation as $key => $nav){ dc($nav); } dc($navigation); */ //$test = $this->sitemap->getOnlineSitemapsTranslationByParentIdAndSitemapCategory(40); //dc($test[0]->categoriesTest); //foreach ($test[0]->categoriesTest as $cat){ // dc($cat->translation->name); //} //dc($breadcrumb[0]->translation->slug); return view('index', compact('sitemap', 'navigation', 'breadcrumb', 'sitemapList')); return "view"; //dc($request->path()); //dc($request); //dc($request->path()); if ($request->path() != "/") { //dc($requestUriArray); $sitemap = $this->sitemap->getSitemapByUrl(); dc($sitemap->id); $navigation = $this->sitemap->getNavigation(); $breadcrumb = $this->sitemap->getBreadcrumb(); //return "view"; //dc($sitemap); dc($breadcrumb); dc('test'); } else { $sitemapId = 1; $sitemap = $this->sitemap->getSitemapForIndex($sitemapId); } return "view"; //return view('index-amp',compact('sitemap','testComposer')); return view('index', compact('sitemap', 'navigation', 'breadcrumb')); //todo post_type nodig, JA DUS VOOR POST REQUEST $id = $request->route()->parameter('id') ? $request->route()->parameter('id') : null; //$post_type = $request->route()->parameter('post_type') ? $request->route()->parameter('post_type') : null; //if (is_null($post_type)){ // $template = Sitemap::with('template')->findOrFail($id)->template; // $post_type = Sitemap::with('template')->findOrFail($id)->template->db_table_name; //} $id = 1; $template = Sitemap::with('template')->findOrFail($id)->template; //todo $allowedParentSitemaps = $this->sitemap->getAllowedParentSitemapsByTemplate($template); $sitemap_list = $this->sitemap->getParentSitemapList($allowedParentSitemaps); $enabledLocales = $this->sitemap->getEnabledLocales(); $sitemap = $this->sitemap->getSelectedSitemap($id, $template); $sitemap = $this->sitemap->setSelectedReferencesBySitemap($sitemap); $this->sitemap->groupMediaCollectionByFieldName($sitemap->translations); //kan weg geen templates wijzigen $template_list = Template::lists('name', 'id'); $template = $sitemap->template; //dc($template); $status_list = collect(['online' => 'Online', 'pending_review' => 'Wacht op review', 'concept' => 'Concept']); //dc($sitemap); $post_type = $template->slug; //voor PostRequest return view('index', compact('sitemap', 'post_type', 'template', 'enabledLocales', 'template_list', 'sitemap_list', 'status_list')); //return view('admin.sitemap.edit',compact('sitemap','post_type','template','enabledLocales','template_list','sitemap_list','status_list')); }