/** * Display the specified resource. * * @param int $id */ public function show($id) { // if exist external content then send it to browser, increment views $external_content = $this->showPage->checkAndGetContentFromHtmlFile(app('veer')->siteId, $id); if (!empty($external_content)) { \Veer\Models\Page::where('id', '=', $id)->increment('views'); return \Response::make($external_content, 200)->header('Content-type', 'text/html'); } $page = $this->showPage->getPage($id, app('veer')->siteId); if (!is_object($page)) { return Redirect::route('page.index'); } $page->increment('views'); $page->load(array('images' => function ($q) { return $q->orderBy('pivot_id', 'asc'); }, 'tags', 'attributes', 'downloads', 'userlists', 'user')); $page->imagesIds = collect($page->images->getDictionary()); if ($page->show_comments == 1) { $this->showPage->loadComments($page, 'page'); } $paginator_and_sorting = get_paginator_and_sorting(); $data = array("page" => $page, "subpages" => $this->showPage->withChildPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "parentpages" => $this->showPage->withParentPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "products" => $this->showPage->withProducts(app('veer')->siteId, $page->id, $paginator_and_sorting), "categories" => $this->showPage->withCategories(app('veer')->siteId, $page->id), "template" => $this->template); $blade_path = $this->template . '.pages.' . $id; $viewLink = $this->template . '.page'; // page with special design if ($page->original == 1 && \View::exists($blade_path)) { $viewLink = $blade_path; } $view = viewx($viewLink, $data); $this->view = $view; return $view; }
/** * Display the specified resource. */ public function show($id) { // @todo if id=0 then it will try to show everything $filtered = $this->showFilter->getFilter(app('veer')->siteId, $id, get_paginator_and_sorting()); $view = viewx($this->template . '.filter', array("products" => $filtered['products'], "pages" => $filtered['pages'], "categories" => $this->showFilter->withCategories($filtered['products'], $filtered['pages']), "tags" => $this->showFilter->withTags($filtered['products'], $filtered['pages']), "attributes" => $this->showFilter->withAttributes($filtered['products'], $filtered['pages']), "template" => $this->template)); $this->view = $view; return $view; }
/** * Display the specified resource. */ public function show($id) { $search = \Veer\Models\Search::find($id); if (!$search) { return $this->index(); } $search->increment('times'); return $this->results($this->showSearch->getSearchResultsWithSite(app('veer')->siteId, $search->q, get_paginator_and_sorting())); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $tag = $this->showTag->getTag($id); if (!is_object($tag)) { return Redirect::route('index'); } $paginator_and_sorting = get_paginator_and_sorting(); $view = viewx($this->template . '.tag', array("tag" => $tag, "products" => $this->showTag->withProducts(app('veer')->siteId, $id, $paginator_and_sorting), "pages" => $this->showTag->withPages(app('veer')->siteId, $id, $paginator_and_sorting), "attributes" => $this->showTag->withAttributes($id, app('veer')->siteId), "categories" => $this->showTag->withCategories($id, app('veer')->siteId), "template" => $this->template)); $this->view = $view; return $view; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($template, $filename) { if ($template != "id") { return $this->thumbnails($template, $filename); } $image = $this->showImage->getImageWithSite(app('veer')->siteId, $filename); if (!is_object($image)) { return Redirect::route('index'); } $paginator_and_sorting = get_paginator_and_sorting(); $view = viewx($this->template . '.image', array("image" => $image, "products" => $this->showImage->withProducts(app('veer')->siteId, $filename, $paginator_and_sorting), "pages" => $this->showImage->withPages(app('veer')->siteId, $filename, $paginator_and_sorting), "categories" => $this->showImage->withCategories(app('veer')->siteId, $filename), "template" => $this->template)); $this->view = $view; return $view; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $category = $this->showCategory->getCategory($id, app('veer')->siteId); if (!is_object($category)) { return Redirect::route('index'); } $category->increment('views'); $category->load(array('images' => function ($q) { return $q->orderBy('pivot_id', 'asc'); })); $paginator_and_sorting = get_paginator_and_sorting(); $view = viewx($this->template . '.category', array("category" => $category, "products" => $this->showCategory->withProducts($id, $paginator_and_sorting), "pages" => $this->showCategory->withPages($id, $paginator_and_sorting), "tags" => $this->showCategory->withTags($id), "attributes" => $this->showCategory->withAttributes($id), "template" => $this->template)); $this->view = $view; return $view; }
/** * Display the specified resource. * * @param int $id */ public function show($id, $childId = null) { $attribute = $this->showAttribute->getAttribute($id, $childId); if (!is_object($attribute)) { return \Redirect::route('index'); } $data = array("attribute" => $attribute, "template" => $this->template); if (!empty($childId)) { $page_sort = get_paginator_and_sorting(); array_set($data, 'products', $this->showAttribute->withProducts(app('veer')->siteId, $childId, $page_sort)); array_set($data, 'pages', $this->showAttribute->withPages(app('veer')->siteId, $childId, $page_sort)); array_set($data, 'tags', $this->showAttribute->withTags($attribute->name, $attribute->val, app('veer')->siteId)); array_set($data, 'categories', $this->showAttribute->withCategories($attribute->name, $attribute->val, app('veer')->siteId)); } $view = viewx($this->template . '.attribute', $data); $this->view = $view; return $view; }
/** * Display the specified resource. * * @param int|string $id * @return Response */ public function show($id) { if (in_array($id, array('new', 'ordered', 'viewed'))) { return $this->showProductLists($id); } // @todo queryParams -> filter? $product = $this->showProduct->getProduct($id, app('veer')->siteId); if (!is_object($product)) { return $this->showProductLists('new'); } $product->increment('viewed'); $product->load(array('images' => function ($q) { return $q->orderBy('pivot_id', 'asc'); }, 'tags', 'attributes', 'downloads', 'userlists')); $this->showProduct->loadComments($product, 'product'); $paginator_and_sorting = get_paginator_and_sorting(); $data = array("product" => $product, "subproducts" => $this->showProduct->withChildProducts(app('veer')->siteId, $product->id, $paginator_and_sorting), "parentproducts" => $this->showProduct->withParentProducts(app('veer')->siteId, $product->id, $paginator_and_sorting), "pages" => $this->showProduct->withPages(app('veer')->siteId, $product->id, $paginator_and_sorting), "categories" => $this->showProduct->withCategories(app('veer')->siteId, $product->id), "template" => $this->template); $view = viewx($this->template . '.product', $data); $this->view = $view; return $view; }