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

[FEATURE] Model Class: updateWhere() #572

Closed
timothymarois opened this issue Jun 25, 2017 · 2 comments
Closed

[FEATURE] Model Class: updateWhere() #572

timothymarois opened this issue Jun 25, 2017 · 2 comments

Comments

@timothymarois
Copy link
Contributor

I noticed we have a deleteWhere() on the model class. However the only way you can do an update() is by primary key, so it only makes sense to have an updater for batch changes.

updateWhere(array, array)

If i'm mistaken let me know, but as for the docs and the source code, doesn't appear to be a batch update method. I also know the builder includes the ->where()->update() however, that's not accessible from model, or at least not in the documentation. Thoughts?

And yeah you could use the save() method to accomplish most, but there is occasions where a simple updateWhere() could come in handy for quick updates across the table.

@lonnieezell
Copy link
Member

You can use any Query Builder functionality through model, interspersed with fluent model function calls, too. See these docs.

I can't link directly there, but the Query Builder does have updateBatch, just like in previous versions. Is that what you mean?

@timothymarois
Copy link
Contributor Author

Yeah was having a difficult time getting the same result with builder through the model, though I didn't experiment too much, was in rush mode and quickly went onto another solution to accomplish it. But seeing the delete function, figured there should be a similar one with update. but anyways, we can close this for now. Thanks!

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

2 participants