Example #1
0
 public function show($slug)
 {
     $product = Product::where('slug', '=', $slug)->with('images')->with('attributes')->firstOrFail();
     View::share('pageTitle', $product->name);
     if ($product->description) {
         View::share('pageDescription', $product->description);
     }
     Breadcrumbs::addCrumb($product->category->name, $product->category->url);
     Breadcrumbs::addCrumb($product->name, $product->url);
     $openGraphAttributes = ['og:type' => 'product', 'og:image' => $product->mainImage->imageUrl, 'og:url' => $product->url, 'product:price:amount' => $product->price, 'product:price:currency' => 'BRL', 'product:category' => $product->category->name];
     return View::make('product::product.show', compact('product', 'openGraphAttributes'));
 }