Inheritance: extends Controller
Ejemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  * @param string|null              $guard
  *
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     /*
      * If there is products into the guest cart, its content is transferred
      * to a logged user 'cart' order.
      */
     if (\Illuminate\Support\Facades\Session::has('user.cart_content')) {
         $ordersController = new OrdersController();
         $ordersController->fromGuestToUser($ordersController);
         unset($ordersController);
     }
     return $next($request);
 }
Ejemplo n.º 2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     }
     /**
      * If there is products into the guest cart, its content is transferred
      * to a logged user 'cart' order.
      */
     if (\Illuminate\Support\Facades\Session::has('user.cart_content')) {
         $ordersController = new OrdersController();
         $ordersController->fromGuestToUser($ordersController);
         unset($ordersController);
     }
     return $next($request);
 }