/** * 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'); }