Example #1
0
 /**
  * Change item cart quantity
  *
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function updateCartQuantity(Request $request)
 {
     //get product by url
     $product = $this->productRepo->findByUrl($request->get('url'));
     //get session cart instance
     $sessionCart = $this->sessionCartRepo->findBySessionIdAndProductId($this->sessionId, $product->id);
     //update the new quantity
     $sessionCart->update($request->all());
     //return response
     return response()->json(['success' => 'Cart item quantity updated']);
 }
Example #2
0
 /**
  * Get single product by URL
  *
  * @param $url
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function getSingleProduct($url)
 {
     $this->productRepo->findByUrl($url);
     return view('front.product');
 }
Example #3
0
 /**
  * Get product info
  *
  * @param $url
  * @return \Illuminate\Http\JsonResponse
  */
 public function getProduct($url)
 {
     $product = $this->productRepo->findByUrl($url);
     return response()->json(['product' => $product]);
 }