-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[5.3] add $default parameter to query builder when() method #15421
Conversation
…avel#15167) In instances where your queue driver goes away (network connectivity, database locks, jobs table doesn’t exist, etc), exceptions are generated but never caught by the `pop` method. As a result, `sleep` is never called and these exceptions are spewed to `laravel.log` until either somebody notices, the driver returns, or the log file fills the disk entirely/you tank your <remote bug tracking service> quota for the month.
…o themsaid-fix-files
Fixes the model name variables (from lower case to camel case) when generating a policy class based on a model.
…ework into themsaid-add-issue-template
…ks-consistency [5.3] Fix some phpdoc inconsistencies
…aravel#15380) * Changed startsWith and endsWith to use substr (non mbstring), this is ok here because it doesn't matter whether it's multi-byte unicode chars or not, just that the same number of bytes match at the start or the end. The performance of the existing methods becomes increasingly slow with larger strings due to mbstring functions. * removed spacing between parenthesis
…avel#15397) * Add test to prevent a potential regression * Restore support for non-string needle * Code unification
allows you to specify a default in the case that the when() $value is false
Submit to master? |
@tomschlick thank you but please submit to master since it's a breaking change. |
I can switch it if necessary... was just following what I have done in the past and what is done in the existing pull requests. If you re-open the pull request I can change the branch on it through the edit button... Github enabled that a few weeks ago. This also is not breaking... |
Ugh I guess that doesn't work that well. I'll re-open on master. |
@tomschlick I guess it's better that you open a new PR to master, this switching thing on GitHub sometimes acts weird, and till this point I was too lazy to understand why it acts that way :) |
This allows you to specify a default closure to run if the
when()
$value attribute is false.I recently found myself creating a sorting / filtering system with defaults that the user could change. Without this you would have to do all kinds of wackiness to clear the previous where() clause on $value being true.
Here is an example of this in action