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

[8.x] QueryBuilder add clone() #34780

Merged
merged 2 commits into from Oct 12, 2020
Merged

[8.x] QueryBuilder add clone() #34780

merged 2 commits into from Oct 12, 2020

Conversation

nuernbergerA
Copy link
Contributor

Hey Guys!

Sometimes you have to do multiple things with the same "base" query.
To avoid unwanted behavior we should clone the QueryBuilder.

We can already archive with clone.

(clone $query)

With this PR we could just chain it.

$query->clone()

In case you don't want this you can grab the first commit so cloneWithout() and cloneWithoutBindings() are covered with tests.

Cheers Adrian


Inspired by @calebporzio livewire screencast

@taylorotwell taylorotwell merged commit 4f59d32 into laravel:8.x Oct 12, 2020
@nuernbergerA nuernbergerA deleted the clone-query-builder branch October 12, 2020 16:50
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