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

[6.x] Add wherePivotNotIn and orWherePivotNotIn methods #30671

Merged
merged 3 commits into from
Nov 25, 2019

Conversation

webchopin
Copy link
Contributor

@webchopin webchopin commented Nov 24, 2019

The main goal of this PR is to add more convenience.

Similar to what is done in Illuminate\Database\Query\Builder with whereNotIn and orWhereNotIn, I added 2 methods called wherePivotNotIn and orWherePivotNotIn.
I did it in exactly the same way whereNotIn and orWhereNotIn are built.

Instead of a call like:

$post->wherePivotIn('flag',['foo','bar'],'and',true);

with this PR, developers could use

$post->wherePivotNotIn('flag',['foo','bar']);

Basically, $post->wherePivotIn('flag',['foo','bar'],'and',true); will be called behind the scenes.

I also added tests for both methods. Besides, since I could not find any test for the orWherePivotIn method which was already part of the framework before this PR, I added a test for this method also.

Based on the contribution guide, I assumed it was a minor feature fully backward compatible since the added methods are new Laravel API methods which are not referenced anywhere else in the framework. That's why I pushed it to the latest stable branch. If you prefer to have it on the master branch, please let me know.

Also, if the PR is accepted, please let me know if you want to mention wherePivotNotIn in the documentation. I couldn't find orWherePivotIn in the documentation, so I guess there is no need to add orWherePivotNotIn either.

@taylorotwell taylorotwell merged commit c684bb3 into laravel:6.x Nov 25, 2019
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.

2 participants