public function handle($request, Closure $next)
    {
        if ($request->path() === config('auto-deploy.route')) {
            if (!config('auto-deploy.require-ssl') || $request->secure()) {
                $origin = $this->determineOrigin();
                if (null !== $origin) {
                    if ($origin->isAuthentic()) {
                        // set the origin type in the controller
                        $request->offsetSet('origin', $origin);

                        return $next($request);
                    } else {
                        abort(403, 'Forbidden. Could not verify the origin of the request.');
                    }
                } else {
                    abort(403, 'Forbidden. Could not determine the origin of the request.');
                }
            } else {
                abort(403, 'Forbidden. Webhook requests must be sent using SSL.');
            }
        }
        // Passthrough if it's not our specific route
        return $next($request);
    }
public function handle($request, Closure $next)
    {
        if ($request->path() === config('auto-deploy.route')) {
            if (!config('auto-deploy.require-ssl') || $request->secure()) {
                $origin = $this->determineOrigin();
                if (null !== $origin) {
                    if ($origin->isAuthentic()) {
                        // set the origin type in the controller
                        $request->offsetSet('origin', $origin);

                        return $next($request);
                    } else {
                        abort(403, 'Forbidden. Could not verify the origin of the request.');
                    }
                } else {
                    abort(403, 'Forbidden. Could not determine the origin of the request.');
                }
            } else {
                abort(403, 'Forbidden. Webhook requests must be sent using SSL.');
            }
        }
        // Passthrough if it's not our specific route
        return $next($request);
    }
public function handle ( $ request , Closure $ next ) { if ( $ request -> path ( ) === config ( 'auto-deploy.route' ) ) { if ( ! config ( 'auto-deploy.require-ssl' ) || $ request -> secure ( ) ) { $ origin = $ this -> determineOrigin ( ) ; if ( null !== $ origin ) { if ( $ origin -> isAuthentic ( ) ) { // set the origin type in the controller $ request -> offsetSet ( 'origin' , $ origin ) ; return $ next ( $ request ) ; } else { abort ( 403 , 'Forbidden. Could not verify the origin of the request.' ) ; } } else { abort ( 403 , 'Forbidden. Could not determine the origin of the request.' ) ; } } else { abort ( 403 , 'Forbidden. Webhook requests must be sent using SSL.' ) ; } } // Passthrough if it's not our specific route return $ next ( $ request ) ; }
Handles the HTTP request.

@param Illuminate\Http\Request $request The request
@param Closure                 $next    Mechanism for passing the result down the pipeline to the next piece of middleware

@return Illuminate\Http\Response A Response object that is passed to the next piece of middleware
Handles the HTTP request .