Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot query relationship name with underscore #332

Closed
felix28 opened this issue Sep 17, 2019 · 2 comments
Closed

Cannot query relationship name with underscore #332

felix28 opened this issue Sep 17, 2019 · 2 comments

Comments

@felix28
Copy link

felix28 commented Sep 17, 2019

I have a relationship named as user_other_infos and check_ups. I put them inside here:

->allowedIncludes(['user_other_infos', 'check_ups', 'cashiers', 'fecalyses']);

Those without underscore works but those with underscore don't work.

For now, I am removing the underscore to make it work.

@vdbelt
Copy link

vdbelt commented Sep 18, 2019

The names of the relationships will be converted to camel case.

So for user_other_infos, laravel-query-builder will look for userOtherInfos

@thijsw
Copy link

thijsw commented Jan 12, 2021

I'm using this workaround for now:

->allowedIncludes(
  'cashiers',
  collect([
     new AllowedInclude('check_ups', new IncludedRelationship(), 'check_ups'),
  ])
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants