Esempio n. 1
0
 public function register(array $options = array())
 {
     $perPage = !empty($optons['perPage']) ? $optons['perPage'] : 3;
     $pages = !empty($optons['pages']) ? $optons['pages'] : 3;
     $products = Product::limit($perPage * $pages)->with('images')->get();
     $frames = array_chunk($products->all(), $perPage);
     return View::make('product::widgets.carousel.carousel', compact('frames'));
 }
Esempio n. 2
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'));
 }
Esempio n. 3
0
 /**
  * Remove the specified product from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Product::destroy($id);
     return Redirect::route("admin.product.index", ['successMessage' => 'Produto removido com sucesso', 'category' => Input::get('category')]);
 }
Esempio n. 4
0
 public function deepProducts()
 {
     $listIdCategory = $this->deepSubitems()->fetch('id');
     $listIdCategory->add($this->id);
     return Product::whereIn('category_id', $listIdCategory->toArray());
 }
Esempio n. 5
0
 public function makeValidator($data)
 {
     $validator = $this->_model->getValidator($data, null);
     $validator->setAttributeNames(Product::getAttributeNames());
     return $validator;
 }