Open MrJmpl3 opened 4 years ago
@can
expects a model to check the ability against. Since you do not provide one explictly, Lighthouse guesses that your model is called String
and looks for such a class.
@can
expects a model to check the ability against. Since you do not provide one explictly, Lighthouse guesses that your model is calledString
and looks for such a class.
In other words, @can
, isn't a laravel can middleware, is more like a policies. I think you should rename @can
to @policy
, and make another @gate
and this work with simple gates
Describe the bug
Don't work with simple permission
Expected behavior/Solution
I think that is because the directive execute
$gate->check($permission, [$model, $others])
, that make error because the directive try to find the $model in the Schema to get the type of Model Class.I only need
$gate->check($permission)
without params.Maybe related: https://github.com/nuwave/lighthouse/issues/1293
Steps to reproduce
Query:
Schema:
Output/Logs
Lighthouse Version
v4.16.0