public function apply(callable $handler)
    {
        $result = $handler;
        foreach ($this->middlewares as $middleware) {
            $result = $middleware($result);
        }

        return $result;
    }
public function apply(callable $handler)
    {
        $result = $handler;
        foreach ($this->middlewares as $middleware) {
            $result = $middleware($result);
        }

        return $result;
    }
public function apply ( callable $ handler ) { $ result = $ handler ; foreach ( $ this -> middlewares as $ middleware ) { $ result = $ middleware ( $ result ) ; } return $ result ; }
Apply the middlewares to the handler.

@param  callable $handler the handler to which the middleware applies.

@return callable
Apply the middlewares to the handler .