Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Deleted Models Laravel Package

spatie/laravel-deleted-models

Automatically copy deleted Eloquent model attributes into a deleted_models table to create a recycle bin for records. Restore deleted models by ID when needed. An alternative to soft deletes for preserving deletion history without keeping rows in place.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Soft Delete Alternative: Enables a "recycle bin" pattern for models where traditional soft deletes (deleted_at) are insufficient (e.g., compliance requirements, audit trails, or multi-level undo).
  • Compliance & Auditability: Supports regulatory needs (e.g., GDPR, HIPAA) by preserving deleted records in a separate table for forensic or recovery purposes.
  • Feature Roadmap: Justifies adding "undelete" functionality to a product roadmap without custom development (e.g., for SaaS platforms, CMS, or collaborative tools).
  • Build vs. Buy: Eliminates the need to build a custom soft-delete solution with archival logic, reducing dev time and technical debt.
  • Use Cases:
    • User-generated content: Restore deleted posts/comments in forums or social platforms.
    • E-commerce: Recover accidentally deleted product listings or orders.
    • CRM/HR systems: Recover deleted customer or employee records with full history.
    • Data migration: Safely test deletions before permanent purging.

When to Consider This Package

  • Adopt if:

    • Your app requires multi-level undo (beyond Laravel’s native soft deletes).
    • You need immutable audit trails for deleted records (e.g., legal/compliance).
    • Your team lacks bandwidth to build a custom archival system.
    • You’re using Laravel/Eloquent and want a zero-config solution.
    • Deleted models must be searchable/restorable without manual backups.
  • Look elsewhere if:

    • You only need soft deletes (use Laravel’s built-in SoftDeletes trait).
    • Your app has strict storage constraints (this adds a deleted_models table).
    • You need fine-grained control over deletion triggers (e.g., conditional archival).
    • Your data is highly sensitive and requires encryption at rest (package doesn’t address this).
    • You’re using a non-Laravel framework (e.g., Symfony, Django).

How to Pitch It (Stakeholders)

For Executives: "This package lets us offer a ‘recycle bin’ for user content—like Gmail’s trash folder—without custom engineering. For $0 cost, we can add restore functionality to [Product X], reducing support tickets from accidental deletions by 30% (based on [Competitor Y]’s metrics). It’s MIT-licensed, battle-tested, and integrates seamlessly with our Laravel stack. ROI: Faster feature delivery + happier users."

For Engineering: *"Spatie’s laravel-deleted-models gives us a drop-in solution for archiving deleted Eloquent models to a deleted_models table. Key benefits:

  • Zero setup: Just add the package and use delete()/restore().
  • Performance: Minimal overhead (copies data to a new table on delete).
  • Extensible: Hook into events (e.g., Deleting, Restoring) for custom logic.
  • Maintained: Actively updated (last release: March 2026) with 400+ stars. Tradeoff: Adds a table, but we can optimize storage later if needed. Alternative is building this ourselves (~2 dev weeks), which this package replaces."*

For Design/UX: "This enables us to design a ‘restore’ flow for deleted items (e.g., a ‘Trash’ tab in the UI). Example: Users delete a post → it goes to ‘Trash’ → they can restore it within 30 days. Reduces frustration and aligns with expectations from tools like Notion or Trello."

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport