made with Laravel

Laravel Cascade Soft Deletes

Cascading Deletes for Eloquent Models

Visit Site

Description

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."


Creator

Michael Dyrynda
@michaeldyrynda


Social Media Links

Actionable Reusable Laravel Actions
icon-eye-dark Created with Sketch. 734
LaraPersonate Login as different users
icon-eye-dark Created with Sketch. 2.082
Sentry for Laravel Laravel Application Monitoring
❤️ Sponsored by Friends
Laravel Request Logger Logging of Requests & Responses
icon-eye-dark Created with Sketch. 2.119
Squire Static Eloquent Model Library
icon-eye-dark Created with Sketch. 2.209
Laroute Generate Laravel Route URLs from JavaScript
icon-eye-dark Created with Sketch. 1.052