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

Detaching twice #13

Open
Ir00man opened this issue May 26, 2021 · 2 comments
Open

Detaching twice #13

Ir00man opened this issue May 26, 2021 · 2 comments

Comments

@Ir00man
Copy link

Ir00man commented May 26, 2021

Do you think that detach() method should detach all related models OR only those are attached?
I mean if call something like this: Post::find(495)->tags()->detach(); twice deleted_at column will be updated 2 times.
Can we leave records untouched in pivot table when they are already deleted (deleted_at column != null)?

@Ir00man
Copy link
Author

Ir00man commented May 26, 2021

Actually my problem can be solved by using Post::find(495)->tags()->sync([]);
This way deleted_at column will not be updated if it's not empty.
But still do you think that detach() method should respect already deleted records and keep them as is?

@ddzobov
Copy link
Owner

ddzobov commented May 26, 2021

I think this is good idea.

feel free to make PR with changes

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

No branches or pull requests

2 participants