【发布时间】:2020-06-19 01:45:43
【问题描述】:
标题说明了一切。
如果我有这样的事情:
type Model {
id
name
}
并且只有特定用户才能访问ID 字段。我该怎么做?
如果特定用户只能访问 Model > relationship 数据,情况也是如此。如何根据用户能力隐藏属性?
【问题讨论】:
标签: laravel graphql laravel-lighthouse
标题说明了一切。
如果我有这样的事情:
type Model {
id
name
}
并且只有特定用户才能访问ID 字段。我该怎么做?
如果特定用户只能访问 Model > relationship 数据,情况也是如此。如何根据用户能力隐藏属性?
【问题讨论】:
标签: laravel graphql laravel-lighthouse
您可以使用@can 指令,例如:
type Model {
id: ID! @can(...)
}
【讨论】:
Type 'Int' on 'attribute_name' can not be found in the schema. 如果我在你的答案中显示的类型属性之后使用'@can'