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;
    }
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;
    }
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 ; }
Add the route middlewares to the action array.

@param array $action

@return array
Add the route middlewares to the action array .