Esempio n. 1
0
 public function getPlaceQueryAutoComplete()
 {
     $d = \GoogleMaps::load('placequeryautocomplete')->setParamByKey('input', 'Pizza near Lon')->setParamByKey('language', 'gb')->getResponseByKey('predictions.place_id');
     dd($d);
 }
 public function indexHome(Request $request)
 {
     $response = '';
     return view('index', compact('response'));
     //https://developers.google.com/maps/premium/optimize-web-services
     $response1 = \GoogleMaps::load('distancematrix')->setEndpoint('json')->setParam(['origins' => 'Groningen|Nederland', 'destinations' => 'Amsterdam|Nederland', 'mode' => 'driving'])->get();
     //->getEndpoint();
     //->get();
     //echo($response1);
     //return $response1;
     //dc(json_decode($response1));
     return response()->json(json_decode($response1), 200);
     return response($response1, 200)->header('Content-Type', 'application/json');
     return response()->json('tet', 200);
     return "view";
     return view('maps', compact('response'));
     //dc($response);
     dc(Permission::with('roles')->get()->pluck('name')->all());
     //dc(Auth::getPermissions());
     $test = Auth::check();
     dc(Auth::check());
     if (Auth::check()) {
         dc('not in');
     } else {
         dc('not logged in');
     }
     dc($test);
     //$user = Auth::loginUsingId(13);
     $user = Auth::user();
     //dc($user::getPermissions());
     dc($user->name);
     dc($user->roles()->get()->pluck('name')->all());
     //dc($user->roles()->permissions());
     $userRoles = $user->roles()->with('permissions')->get();
     dc($userRoles[0]->permissions->pluck('name')->all());
     //dc($user->hasRole('managerx'));
     $component_name = "Bookmarks";
     $references = Reference::with(['translation', 'referencetype', 'updated_by_user'])->whereHas('components', function ($component) use($component_name) {
         // ...1 subquery to filter the photos by related tags' name
         $component->where('name', '' . $component_name . '');
     })->get();
     foreach ($references as $key => $reference) {
         if ($user->can('view_bookmark_reference_' . $reference->id . '')) {
             dc($reference->id . ' - ' . $reference->translation->name);
         }
     }
     //$role->givePermissionTo($permission);
     //dc($references[0]->translation->name);
     return "view";
     //@can('edit_formxx')
     if ($user->can('edit_form')) {
         dc('can edit form');
     } else {
         dc('can\'t edit form');
     }
     if (Gate::denies('update', 'asdf')) {
         //abort(403);
     }
     //dc($user->hasPermission('managerx'));
     return view('welcome');
     dd('public index');
     //$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'));
 }