I tried
type Mutation {
deleteUser(id: ID!): User @delete @broadcast(subscription: "userDeleted")
}
type Subscription {
userDeleted(id: ID!): User
}
and I created a subcription where the methods authorize
and filter
return true
.
But I get this error:
Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\User]
The deleteUser
mutation works. Only the subscription does not work. I use Pusher for broadcast and the error appeared in the horizon dashboard.
If you really need a solution right now, just make a custom resolver where you firstly brodcast the event and then delete the user... (you can even make a custom directive that generalizes it).
Otherwise, you will have to dig a bit into the Lighthouse's internals to find a solution.