Soft Deletes and Restore
Use this page when records should be recoverable instead of permanently removed.When delete() is soft
delete() behaves as a soft delete when the model has a deleted_at soft-delete field in its schema.
Valid schema patterns:
What soft delete does
Soft delete updatesdeleted_at instead of permanently removing the record.
Typical service call:
How restore() works
restore() clears deleted_at and makes the record visible again to normal reads.
Hard delete after soft delete
UseforceDelete() only when the record should be permanently removed:
forceDelete(), do not assume restore() can recover the record.
Querying deleted records
Recommended controller and service split
- controllers expose
restoreroutes when recovery is part of the API - services own
restore,onlyTrashed,withTrashed, andforceDelete - models define the schema requirement
Safe usage notes
- use soft delete for recoverable business entities
- use
forceDeleteonly in admin or cleanup paths - do not document restore as guaranteed after force delete
- keep restore paths covered in tests