protected static function _checkMiddleware(Requests $request, $middleware_symbols)
    {
        // get all route middlewares
        $route_middlewares = Config::get('middleware.route');    
        // get current request route middlewares
        $request_middlewares = [];
        foreach ($middleware_symbols as $middleware_symbol) {
            // if middleware_symbol is not in route_middlewares
            if ( ! array_key_exists($middleware_symbol, $route_middlewares)) {
                throw new \InvalidArgumentException("route middleware $middleware_symbol is not exists!");
            }
            $request_middlewares[] = $route_middlewares[$middleware_symbol];  
        }
        // run middleware flow
        return Middleware::run($request_middlewares, $request);
    }
protected static function _checkMiddleware(Requests $request, $middleware_symbols)
    {
        // get all route middlewares
        $route_middlewares = Config::get('middleware.route');    
        // get current request route middlewares
        $request_middlewares = [];
        foreach ($middleware_symbols as $middleware_symbol) {
            // if middleware_symbol is not in route_middlewares
            if ( ! array_key_exists($middleware_symbol, $route_middlewares)) {
                throw new \InvalidArgumentException("route middleware $middleware_symbol is not exists!");
            }
            $request_middlewares[] = $route_middlewares[$middleware_symbol];  
        }
        // run middleware flow
        return Middleware::run($request_middlewares, $request);
    }
protected static function _checkMiddleware ( Requests $ request , $ middleware_symbols ) { // get all route middlewares $ route_middlewares = Config :: get ( 'middleware.route' ) ; // get current request route middlewares $ request_middlewares = [ ] ; foreach ( $ middleware_symbols as $ middleware_symbol ) { // if middleware_symbol is not in route_middlewares if ( ! array_key_exists ( $ middleware_symbol , $ route_middlewares ) ) { throw new \ InvalidArgumentException ( "route middleware $middleware_symbol is not exists!" ) ; } $ request_middlewares [ ] = $ route_middlewares [ $ middleware_symbol ] ; } // run middleware flow return Middleware :: run ( $ request_middlewares , $ request ) ; }
check middlewares.

@param  WorkerF\Http\Requests $request
@param  array $middleware_symbols
@return mixed
@throws \InvalidArgumentException
check middlewares .