Askedio/laravel-soft-cascade

Restoring unwanted rows

Closed this issue · 4 comments

Description:

I have an application where users can create posts. I've given users the ability to delete posts which performs a soft delete on the record. In the following use case i restore records that I don't want.

  • User creates 3 posts
  • User deletes 1 of those posts which is soft deleted
  • Admin deletes the user and it is softdeleted along with 2 more posts(cascading).
  • Admin restores the user, but all 3 posts are restored.

Is there a way to only restore records that were done by the cascading soft delete.

The only posts that needs to be restored are the ones that where deleted on the same time as user. For this to work posts should only be deleted in cascade if they were not already deleted previously.

To be more precise: The only post (the children) that needs to be restored are the ones that were deleted on the same time as user (the parent) OR LATER. For this to work:

  • Posts (the children) must be deleted after the user (the parent) was soft-deleted.
  • Posts should only be soft-deleted in cascade if they were not already deleted previously.

Hello, is this fixed? Or is it still open?

You are free to make a PR with the improvement. I'm not using package anymore and only I will review PR's.