made with Laravel

Laravel Cascade Soft Deletes

Cascading Deletes for Eloquent Models

Visit Site


Cascading Deletes for Eloquent Models

"In scenarios when you delete a parent record - say for example a blog post - you may want to also delete any comments associated with it as a form of self-maintenance of your data.

Normally, you would use your database's foreign key constraints, adding an ON DELETE CASCADE rule to the foreign key constraint in your comments table.

It may be useful to be able to restore a parent record after it was deleted. In those instances, you may reach for Laravel's soft deleting functionality.

In doing so, however, you lose the ability to use the cascading delete functionality that your database would otherwise provide. That is where this package aims to bridge the gap in functionality when using the SoftDeletes trait."


Michael Dyrynda

Social Media Links

Server Monitor Monitor the Health of your Server & App
icon-eye-dark Created with Sketch. 5.142
Laravel Mixins Collection of useful Helpers
icon-eye-dark Created with Sketch. 2.041
Sentry for Laravel Laravel Application Monitoring
❤️ Sponsored by Friends
We’re hosting on Digital Ocean! 💙 Try it today and get a free $100 credit.
Laravel Bakery GraphQL Schema Generator
icon-eye-dark Created with Sketch. 1.956
Laravel Mobile Verification Phone Number Verification
icon-eye-dark Created with Sketch. 3.283