-
Notifications
You must be signed in to change notification settings - Fork 1.5k
QueryBuilder
multiply and divide support
#3373
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
base: 5.x
Are you sure you want to change the base?
QueryBuilder
multiply and divide support
#3373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this nice feature that leverage MongoDB update operator.
Could you tell me a bit more about your use-case?
src/Query/Builder.php
Outdated
/** @inheritdoc */ | ||
public function multiply($column, $amount = 1, array $extra = [], array $options = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find this method in the parent class. I only find Illuminate\Collections\Collection::multiply
.
Could you remove the @inheritdoc
annotation and add a description for all @param
and @return
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👌🏻
Case of storing price in centsWe need to get the price converted from cents to USD. DB::table('products')->where('title', 'socks')->divide('price', 100); Case of adding taxDB::table('products')->where('title', 'socks')->multiply('price', 1.2); |
Hello 👋🏻
In this PR I have added
multiply
anddivide
toQueryBuilder
.Usage
Checklist