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

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

Merged

Conversation

bobbybouwmann
Copy link
Contributor

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 Add tests for updating existing pivot + add option for passing model [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
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.

None yet

2 participants