Skip to content

Conversation

Meowbox64
Copy link

Design/Changes:

  • implementation of the cascade soft delete design, but with laravel's restore() action
  • this makes it possible to both cascade delete and restore.
  • caveat is as noted in the readme, that cascade soft restore catches all child model rows with deleted_at datetime >= that of the parent model. This still works great for most situations, but should be noted nonetheless.

Testing:

  • use the laravel cascade soft delete feature on a laravel model with child models defined by a one-to-many relationship within the parent model.
  • ensure all models have use SoftDeletes, and any models that will cascade need to have CascadeSoftDeletes and CascadeSoftRestores as well.
  • trigger laravel's deleting() action on a parent model
    • cascade soft delete should work successfully. you can check your database tables.
  • use laravel's restoring() action on a parent model (likely the same you deleted above)
    • cascade soft restore should work successfully. you can check your database tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant