gigerit/laravel-cascade-delete
gigerit/laravel-cascade-delete brings trait-based cascade deletes to Laravel Eloquent models, automatically removing related records when a parent is deleted. Prevent orphaned rows without fragile DB foreign keys and keep your data consistent and relationships tidy.
ON DELETE CASCADE at the database level does not fire when a model uses SoftDeletes, and Eloquent has no built-in recursive cascade. This package closes that gap, so the decision is whether to hand-roll cascade/soft-delete traversal in every model or adopt a maintained implementation. Rolling your own is deceptively expensive once polymorphic relations and deep object graphs enter the picture.delete(), forceDelete(), trashed() and friends). No new features, no deprecations, no breaking changes. It improves correctness and forward-compatibility with custom SoftDeletes implementations and future Laravel versions — a low-risk, recommended bump to ^1.3.4, not a roadmap item.Consider adoption when:
SoftDeletes on some or all of those models and need cascades that respect trashed state, restore paths, and forced deletes — the exact area this patch touched.Look elsewhere when:
ON DELETE CASCADE with hard deletes is sufficient — adding a package here is unnecessary surface area.deleting observer code would do.For executives: Deleting data sounds trivial and is not. When a customer closes an account or exercises a data-erasure right, every related record has to go — and if any are missed, that is a compliance and trust problem. Today that logic is written by hand, model by model, and is easy to get subtly wrong. This package is a small, focused, actively maintained dependency that handles cascading deletion correctly, including for records we only soft-delete so they can be restored. The current release (v1.3.4) is a bug fix with no breaking changes: it aligns the package with the supported soft-delete interface, which lowers our upgrade risk. Cost is near zero; the benefit is fewer defects in a high-consequence code path.
For engineering: Adopt gigerIT/laravel-cascade-delete at ^1.3.4 to replace bespoke recursive-delete logic. It runs cascades through Eloquent model events, so observers, policies, and audit hooks continue to fire, and it correctly distinguishes soft delete from force delete. The v1.3.4 fix moves the package off internal soft-delete implementation details onto the public API, which means our custom SoftDeletes traits and future Laravel upgrades are less likely to conflict. Migration is incremental — enable it per model, add tests around restore and force-delete paths, and benchmark on our largest object graphs before rolling it out to tenant deletion. Recommendation: pilot on one low-risk subtree, then standardize.
How can I help you explore Laravel packages today?