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

Add support for eager loading specific columns to withWhereHas #45168

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

diaafares
Copy link
Contributor

Hi,
withWhereHas() didn't work as expected when I tried to eager load specific columns the same way that we are doing using with('user:id,first_name,last_name') and it gave me the following error:
Call to undefined method Employee::user:id,first_name,last_name()

This PR adds support for eager loading specific columns to withWhereHas(), so it is now consistent with with() method and works as expected:
withWhereHas('user:id,first_name,last_name')

Please let me know if anything is needed ☺️

@taylorotwell taylorotwell merged commit d961975 into laravel:9.x Dec 2, 2022
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

Successfully merging this pull request may close these issues.

2 participants