Disallowing certain include types #896
Unanswered
countless-integers
asked this question in
Show and tell
Replies: 1 comment
-
Yes, please! I was talking with the owner of Scramble (a Laravel documentation generator) and noticed something strange. When using; ->allowedIncludes(['categories'])` the generated docs also include the
It would be nice if there was a way to exclude those two methods. Thanks to @RomaLyt for coming up with a quick fix: collect([new AllowedInclude('categories', new IncludedRelationship())]) Still, it would be better if this was handled in the package itself. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now, adding includes to query params allows for "count" and "exists" variations of them. E.g.
would accept query params like
include[]=user
,include[]=userCount
orinclude[]=userExists
. This behaviour seems to be a consequence of this bit of code inAllowedInclude
.What I'd like to achieve is to prevent users from being able to use
userCount
anduserExists
include values (or at the very least, hide those options from the exception message thrown inAddsIncludesToQuery
.I've somewhat hacked my way to that result by setting suffix values for those parameters to an empty string (e.g. for
exists_suffix
), but this feels a bit brittle.What would you advise for me to do instead to get that functionality of disallowing those include types?
Beta Was this translation helpful? Give feedback.
All reactions