我试图嵌套删除突变。但它不起作用。
但我不知道为什么它不起作用。
我有桌子A and B
。
一个数据A
可以有很多数据B
所以在A模型内部,我写了如下关系。
public function bRelation(): HasMany
{
return $this->hasMany('App\Models\A', 'A_id', 'id');
}
这不是真实的,而是我的架构的缩写版本。
extend type Mutation {
createA(input: AInput@spread): A@create
updateA(input: AInput@spread): A@update
deleteA(input: AInput! @spread): A@delete
}
input AInput{
id: ID
bRelation : bRelationInput
}
input bRelationInput{
create: [bInput]
update: [bInput]
delete: [ID!]
}
input bInput {
id: ID
}
我首先使用如下邮递员。
删除表A中id为35的数据。但是表b数据没有被删除。
即使我改变了架构和数据,如下所示。结果是一样的。b 数据不被删除
input bRelationInput{
create: [bInput]
update: [bInput]
delete: Boolean
}
我做错什么了..??