protected function loadMiddleware()
    {
        $config = $this->app->make('config');

        $this->router->middlewarePriority = $this->middlewarePriority;

        $this->middleware = $config->get('http.middleware', []);

        $middlewareGroups = $config->get('http.middleware_groups', []);

        foreach ($middlewareGroups as $key => $middleware) {
            $this->router->middlewareGroup($key, $middleware);
        }

        $routeMiddleware = $config->get('http.route_middleware', []);

        foreach ($routeMiddleware as $key => $middleware) {
            $this->router->aliasMiddleware($key, $middleware);
        }
    }