/**
  * Checks that a user has a shopping cart, and that it has products. Useful for checking out
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // check if the shopping cart has any items
     if ($this->shoppingCart->hasProducts()) {
         return $next($request);
     }
     return view('frontend.cart.index');
 }
 /**
  * @return int
  */
 public function emptyCart()
 {
     // empty the shopping cart
     return $this->shoppingCart->makeItEmpty();
 }
Beispiel #3
0
 /**
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function removeAllProducts(Request $request)
 {
     $this->data = $this->shoppingCart->makeItEmpty();
     return $this->handleRedirect($request);
 }