简体   繁体   中英

Soft deleting in pivot with sync method laravel

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

我认为您正在寻找这种方法。

$user->your_relation()->updateExistingPivot($userid, ['deleted_at' => $date]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM