/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $product = Product::whereSlug($id)->first();
     return view('admin.product.show', compact('product'));
 }
Exemple #2
0
 public function product($slug)
 {
     //$parts = array_values(array_filter(explode("/", $slug)));
     $parts = array_values(array_filter(explode("/", $slug)));
     $last = $parts[count($parts) - 1];
     return Product::whereSlug($last)->first();
 }
 public function getDetail($slug)
 {
     $categories = Category::all();
     $product = Product::whereSlug($slug)->firstOrfail();
     return view('front.detail', compact('categories', 'product'));
 }
 public function wishlistAdd($slug)
 {
     $product = Product::whereSlug($slug)->firstOrFail();
     Cart::instance(auth()->user()->id . 'wishlist')->add(['id' => $product->id, 'name' => $product->name, 'qty' => 1, 'price' => $product->price, 'options' => ['slug' => $product->slug]]);
     return redirect('/wishlist');
 }