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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Add tests for updating existing pivot + add option for passing model #23535

Merged
merged 1 commit into from Mar 14, 2018

Conversation

Projects
None yet
2 participants
@bobbybouwmann
Contributor

bobbybouwmann commented Mar 14, 2018

Added the parseId method to the InteractsWithPivotTable trait. This way we can now use models to update existing pivot values. For example

// Before (which still works as well)
$post->tags()->updateExistingPivot($tag->id, ['key' => 'value']);

// After
$post->tags()->updateExistingPivot($tag, ['key' => 'value']);

In addition to that I also added the missings tests for this method ;)

If for some reason you decide not to take the model part, you can at least add the tests 馃憤

@GrahamCampbell GrahamCampbell changed the title from Add tests for updating existing pivot + add option for passing model to [5.6] Add tests for updating existing pivot + add option for passing model Mar 14, 2018

@taylorotwell taylorotwell merged commit a05ee88 into laravel:5.6 Mar 14, 2018

2 checks passed

continuous-integration/styleci/pr The StyleCI analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment