cesargb/laravel-cascade-delete
MorphOne, MorphMany, MorphToMany), a common pain point in Laravel apps with complex data hierarchies (e.g., media attachments, comments, or audit logs tied to multiple models).cascadeDeleteMorph configuration—no database migrations or schema changes.Comment models linked to Post, User, or Video). Less useful for non-polymorphic cascades.SoftDeletes trait—could conflict if not handled.SoftDeletes) used? If yes, will the package conflict or require customization?content_type/content_id)? The package may need adjustments.delete() with with() or custom observers achieve the same goal with less risk?MorphTo, MorphOne, etc.Media, Comment).Post and Comment) in a staging environment.cascadeDeleteMorph in target models (e.g., ['comments', 'media']).use Cesargb\Database\Support\CascadeDelete;
class Post extends Model {
use CascadeDelete;
protected $cascadeDeleteMorph = ['comments', 'media'];
}
morphClass overrides if using non-standard keys.Comment vs. User).feature() flags to toggle cascading deletes during rollout.cascadeDeleteMorph).Post should remove all Comments").How can I help you explore Laravel packages today?