Asvae\ApiTester\Http\Middleware\DetectRoute::handle PHP Method

handle() public method

public handle ( Illuminate\Http\Request $request, Closure $next )
$request Illuminate\Http\Request
$next Closure
    public function handle(Request $request, Closure $next)
    {
        // In case the request was sent by Api Tester and wanted route-info
        // we will halt the request and output route information instead.
        if ($request->header('X-Api-Tester') === static::ROUTE_INFO) {
            // Laravel 5.1 event
            $this->events->listen('router.matched', [$this, 'handleMatchedRoute']);
            // Laravel 5.2 event
            $this->events->listen(RouteMatched::class, function (RouteMatched $event) {
                $this->handleMatchedRoute($event->route);
            });
        }
        return $next($request);
    }