it works with @can(ability: "your ability", find: "id") or @canFind
not working with @can(ability: "your ability", find: "input.id") or @canFind
if I pass "input.id" not "id" I always get "Got no key to find a model at the expected input path: input.id."
so for now I end up separate the primary key from input
updateSupport ( id: ID! input: UpdateSupportInput! @spread ): Support @canFind(ability: "update", find: "id") @update
SupportPolicy
public function update(User $user, Support $support): bool {
return $user->id === $support->user_id;
}
3. query from GraphiQL
mutation MyMutation {
updateSupport(input: {id: "100", body: "blah", title: "test"}) {
body
id
replied
reply
title
}
}
**Output/Logs**
<details><summary>Click to expand</summary>
"errors": [
{
"message": "Got no key to find a model at the expected input path: input.id.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"updateSupport"
],
Describe the bug
it works with
@can(ability: "your ability", find: "id")
or@canFind
not working with@can(ability: "your ability", find: "input.id")
or@canFind
if I pass "input.id" not "id" I always get "Got no key to find a model at the expected input path: input.id."so for now I end up separate the primary key from input
updateSupport ( id: ID! input: UpdateSupportInput! @spread ): Support @canFind(ability: "update", find: "id") @update
Expected behavior/Solution
Steps to reproduce
setup User hasMany Support, Support belongsTo User relationship.
input UpdateSupportInput { id: ID! title: String @rules(apply: ["max:40"]) body: String }
SupportPolicy public function update(User $user, Support $support): bool { return $user->id === $support->user_id; }
mutation MyMutation { updateSupport(input: {id: "100", body: "blah", title: "test"}) { body id replied reply title } }
"errors": [ { "message": "Got no key to find a model at the expected input path: input.id.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "updateSupport" ],