laravel-pivot-softdeletes
laravel-pivot-softdeletes copied to clipboard
Detaching twice
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)?
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?
I think this is good idea.
feel free to make PR with changes