Closed mr-feek closed 1 year ago
Hi, @mr-feek! Nope, plugin's nothing know about pivot tables for your model relations, you need self write this logic.
Example, try create for user_addresses
a model UserAddress
with deletedAt
column and use soft-delete. And add to User
model a relation through HasManyThrough for addresses
Great, I'll give that a shot. Thank you for the advice and quick response! 🤝
Hi,
Is it currently possible to soft delete pivot records?
Imagine I have a relationship like the following:
users
(many to many) user_addresses
addresses
The library does work well when
addresses
are soft deleted, despite the pivot relationship still being there (user.addresses
relationship is empty).However, I would also like the pivot table record to be soft deleted as well (when calling the likes of
detach
). Is that possible out of the box with this package? I couldn't find any references in the codebase forpivot
ormany to many
that looked like they handle the automatic pivot model that adonis creates