graphql + laravel灯塔:如何将枢轴数据带到父对象?

时间:2020-04-24 16:06:22

标签: graphql laravel-lighthouse

说我有一个https://lighthouse-php.com/4.11/eloquent/nested-mutations.html#storing-pivot-data的架构,如下所示:

type Movie {
    id: ID!
    pivot: UserMoviePivot
}

type UserMoviePivot {
    "How well did the user like the movie?"
    rating: String
}

以及随后的查询:

{
  id
  seenMovies {
    id
    pivot {
      rating
    }
  }
}

产生如下所示的内容:

"seenMovies": [
  {
    "id": 6,
    "pivot": {
      "rating": "A perfect 5/7"
    }
  }
]

有什么方法可以将数据透视表带入父级以产生类似的结果?

"seenMovies": [
  {
    "id": 6,
    "rating": "A perfect 5/7"
  }
]

0 个答案:

没有答案