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

Return builder after relations #410

Merged
merged 5 commits into from
Jan 9, 2020

Conversation

BertvanHoekelen
Copy link
Contributor

@BertvanHoekelen BertvanHoekelen commented Jan 8, 2020

As discussed in #409.

I had to put it before the Mixins pipe. Otherwise the Builder mixin on Relation would handle it and stop the pipe from executing.

The only thing that doesn't work is (new User())->accounts()->whereFoo('bar');. I didn't want to copy the code from BuilderDynamicWheres so let's discuss how to handle that.

@canvural
Copy link
Collaborator

canvural commented Jan 8, 2020

Thank you! It's great.

But I was wrong in my comment here. $user->accounts()->where('foo', 'bar') should return the relation, not the builder. Same for $user->accounts()->whereIn('id', [1, 2, 3]) I tested this in Tinker in a live project, and indeed the relation is returned not the builder.

Can you fix that?

@BertvanHoekelen
Copy link
Contributor Author

Done!

Do you have any suggestions on how we can handle those dynamic wheres? Or should we leave it for now and create an issue as feature request?

@canvural canvural merged commit 430ccef into larastan:master Jan 9, 2020
@canvural
Copy link
Collaborator

canvural commented Jan 9, 2020

Looks good! Thank you!

@BertvanHoekelen BertvanHoekelen deleted the builder-after-relations branch January 9, 2020 08:20
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.

None yet

2 participants