Open ahinkle opened 3 years ago
Hey there folks, one thing that has been poking at me for years is the inability to use sync on relationship that's not many-to-many.
sync
Example: post has many links link belongs to post
$post->links()->sync($links) // error undefined method sync
So, you have to do something nasty like:
$post->links()->delete(); $post->links()->saveMany($links);
This is useful for situations where you would sync relational data with an API or relevant. I would be happy to spin up a pull request if others would find this useful.
I think this would be very useful!
Hey there folks, one thing that has been poking at me for years is the inability to use
sync
on relationship that's not many-to-many.Example: post has many links link belongs to post
So, you have to do something nasty like:
This is useful for situations where you would sync relational data with an API or relevant. I would be happy to spin up a pull request if others would find this useful.