You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be awesome if Lighthouse could inject data in the argument set using wildcard in the dot notation, this would cover the nested mutations in the HasMany case, while ensuring that a comment will be created for the authenticated user or a mutation that uses a list of input types.
But, well, this way I'm not using the power of nested mutations.
Maybe I'm wrong, but I think the change needed is just use data_fill instead of Illuminate\Support\Arr::add in the Nuwave\Lighthouse\Schema\Directives\InjectDirective class and rewrite the addValue method of Nuwave\Lighthouse\Execution\Arguments\ArgumentSet class to behave like data_fill as actually it is behaving like Illuminate\Support\Arr::add
Or maybe create a new directive and method.
I'm willing to help with a PR when as soon as I have time available.
Lighthouse Version: 4.9
Laravel Version: 6.12.0
The text was updated successfully, but these errors were encountered:
Thank you for your contribution. You have a totally valid use case.
Powering up @inject in the way you described seems reasonable, i would be willing to incorporate a PR for this.
Another approach to solving that issue would be to default comments/posts to hold the ID of the currently authenticated user when creating them. We are using model events for that. Helps a great deal when most of the models in your application belong to the current user.
Considering this example schema
It would be awesome if Lighthouse could inject data in the argument set using wildcard in the dot notation, this would cover the nested mutations in the
HasMany
case, while ensuring that a comment will be created for the authenticated user or a mutation that uses a list of input types.Of course, today, I can create something like:
But, well, this way I'm not using the power of nested mutations.
Maybe I'm wrong, but I think the change needed is just use
data_fill
instead ofIlluminate\Support\Arr::add
in theNuwave\Lighthouse\Schema\Directives\InjectDirective
class and rewrite theaddValue
method ofNuwave\Lighthouse\Execution\Arguments\ArgumentSet
class to behave likedata_fill
as actually it is behaving likeIlluminate\Support\Arr::add
Or maybe create a new directive and method.
I'm willing to help with a PR when as soon as I have time available.
Lighthouse Version: 4.9
Laravel Version: 6.12.0
The text was updated successfully, but these errors were encountered: