RFC 0088 — The trash: soft-deleted rows seen, restored, and a delete undone
Status: implemented (2026-11-30) · Target: 0.66.0 · builds on RFC 0069, RFC 0079 and RFC 0087 · see Decisions
Summary
A model with soft_deletes keeps a deleted row, with deleted_at set:
with_trashed() reaches it, restore() brings it back. Nothing a user
sees does. RFC 0087's Delete says "They can be restored", and then
there's nowhere to restore them from, and ⌘Z doesn't take it back.
This RFC gives a soft-deleting list its trash:
- A view of the deleted: the list's Trash (a view in RFC 0070's
Views menu,
query.trashed = "only"), the rows with when they were deleted, the command answeringonly_trashed(). - Restore: in the trash, the selection bar's Restore (
onrestoremany(ids)), 500 keys a call, as RFC 0087's Delete. - Undo a delete: with
onrestoremany, a delete of the selection is a step for ⌘Z (RFC 0079): undone by restoring the rows it deleted. make:resourcewrites{p}_restore_many(ids), the index'strashed("with","only"), and over a backend the package'selyraRestoreManyandelyraList'strashed.
Motivation
- "It can be restored" should be true for the user. RFC 0087 says it, for a model that keeps its rows; today only a developer can.
- A delete of 340 rows is the change most worth undoing, and the one RFC 0079's history leaves out.
- The pieces exist:
with_trashed(),only_trashed()andrestore()inelyra::db, Eloquent'sSoftDeletes, the views menu, the selection bar and its chunks.
Current state (0.66)
#[model(soft_deletes)]: queries leave trashed rows out unlesswith_trashed()/only_trashed(); a query'srestore()clearsdeleted_at.make:resourcedeletes softly for such a model.- The selection bar has Delete with
ondeletemanyandsoftDeletes(RFC 0087). A delete isn't a step for ⌘Z. - The Views menu (RFC 0070) has the app's views and the user's; a view
is a query (
filters,search,sort,columns).
Design
The trash, a view
trashon theTable(withonrestoremany, ortrue): the Views menu gets Trash after the app's views. Choosing it setsquery.trashed = "only"; leaving it unsets it. A plain array's table shows the rows whosedeleted_atis set.- In the trash: the list is read-only (no grid, no new row), a
deleted_atcolumn is shown ("Deleted"), the selection bar has Restore instead of Set and Delete, and a callout says "Deleted rows. Restore them to use them again."
Restore
onrestoremany(ids) => Promise<{ restored, failed }>: the selection's
Restore, without a question, 500 keys a call with progress and
Cancel; the restored leave the trash and the selection, the failed stay
selected and are said.
Undo a delete
With onrestoremany, RFC 0087's delete of the selection is a step:
⌘Z restores the rows it deleted (the ones the answer said were), and
⇧⌘Z deletes them again. The confirm doesn't change; the toast after a
delete says "Deleted 338 invoices. ⌘Z to undo."
make:resource (for a model with soft_deletes)
{p}_index's query takestrashed: Option<String>("with","only"), applied withwith_trashed()/only_trashed(), and its rows carrydeleted_at.{p}_restore_many(ids)with the update ability:only_trashed()rows among them restored in one statement,{Model}Updatedfor each; answers{ restored, failed }.- Over a backend:
trashedis sent as the list's query; the package'selyraListreads it ('trashed' => truein its options lets it, for a model usingSoftDeletes);POST {path}/restorewith{ ids }, answered by->elyraRestoreMany($request)with each row'srestorepolicy. - The list with
selectpassestrashandonrestoremany.
Words
trash, trashCallout, restoreSelected, restoring(done, total),
restoringLabel, restoredRows(n), notRestored(n), undoHint,
deletedAt, in words.js and en/nb.
Implementation plan
ui: Trash in the Views menu,query.trashed, the read-only trash with its column and callout, Restore with chunks, the delete as a step withonrestoremany; words.ratatosk:trashedin the index,{p}_restore_manylocal and over a backend, the hints; tests and the smoke (a soft-deleting resource).- The Laravel package:
elyraList'strashed,elyraRestoreMany; the test app's customers withSoftDeletes, arestorepolicy, andframework/tests/laravel_trash.rs. - Docs:
table.md,resources.md,backend.md, the skills, CHANGELOG.
Open questions
- The trash a view, or a toggle above the list? Recommendation: a
view. The Views menu is where a list's other questions are, a view
keeps its own columns and sort, and it's a link (
?view=Trash). - Restore asked first? Recommendation: no. It's the safe way back, and undoable by deleting again.
- Undo a delete without soft deletes? Recommendation: no. Without a restore there's nothing to undo with; the question says "This can't be undone", and means it.
- Emptying the trash (deleting for good)? Recommendation: not in
this RFC. It's a different, destructive command (
forceDelete), worth its own question and ability.
Decisions
Accepted 2026-11-30, with the open questions' recommendations:
- The trash is a view in the Views menu.
- Restore isn't asked first.
- No undo of a delete without soft deletes.
- No emptying the trash (
forceDelete) in this RFC.
As built
As designed, with these differences:
- The trash is an item of the Views menu, after the app's views; its label is the menu's while it's on. All or another view leaves it.
- When a row was deleted reads
deleted_atas unix seconds (an Elyra model's) or a date (Laravel's), in the user's locale. - The undo hint names the platform's key ("⌘Z to undo." on a Mac, "Ctrl+Z" elsewhere).
- The delete and the restore share one runner for their chunks, its progress and Cancel.
- The words are
trash,trashCallout,restoreSelected,restoring,restoringLabel,restoredRows,notRestored,undoHint(key)anddeletedAt. - Tested against the test app the Laravel CI job builds: its
customers have
SoftDeletes,elyraListits'trashed' => true, aPOST /api/customers/restoreroute and aCustomerPolicy::restore, andframework/tests/laravel_trash.rsis a step of its own. The other Laravel tests stay green with soft deletes on.
Not in this RFC
- Deleting for good (
forceDelete), and emptying the trash. - Restoring a row's children with it.
- A trash across resources.
Alternatives considered
- A separate trash page per resource. It repeats the list (search,
filters, columns) for one more
where. - Undo by keeping the deleted rows in the table's memory. They'd be written back as new rows, with new keys, losing what points at them; a restore keeps the row.