protected function addRouteMiddlewares(array $action)
    {
        foreach ([static::API_RATE_LIMIT_MIDDLEWARE, static::API_AUTH_MIDDLEWARE] as $middleware) {
            if (($key = array_search($middleware, $action['middleware'])) !== false) {
                unset($action['middleware'][$key]);
            }

            array_unshift($action['middleware'], $middleware);
        }

        return $action;
    }