问题
I want sync some relation in User's Table and I don't want to Laravel delete the row, I want make some updates on that row (Like fill the deleted_at), I searched so far and only solution i found is that to override sync method.
So how i can override the sync method to update the row?
Or whats another solution for this problem?
EDITED: I know the problem is with detach
method, If i could override the detach
It will be solved!
Thanks
回答1:
I think you were looking for this method.
$user->your_relation()->updateExistingPivot($userid, ['deleted_at' => $date]);
来源:https://stackoverflow.com/questions/47843469/soft-deleting-in-pivot-with-sync-method-laravel