Repository navigation
2.7.0 — Trash for soft-deleting models
Trash for soft-deleting models: delete permanently, restore and "Show deleted". Generator output changes only for tables with a deleted_at column; nothing already generated changes.
Upgrade action
- Update
@dejwcake/craftableto 2.4.0 anddejwcake/admin-uito 2.5.0 before regenerating (not enforced bycomposer.json). - A resource already migrated needs a new migration adding
admin.{model}.restore,bulk-restore,force-deleteandbulk-force-deletepermissions. - A model generated with
--without-modelor written by hand needsisRestorable()(return true;is enough without parent rows). - Overridden
controller,routes,blade-indexandvue-listingtemplates don't get the trash; compare them with the package's.
Added
admin:generate:trash-controllerandadmin:generate:request:{force-destroy,bulk-force-destroy,restore,bulk-restore};admin:generateruns them.- Model
isRestorable()from itsbelongsTorelations; restore refuses non-restorable rows, bulk restore skips them. - Trash routes, permissions, "Show deleted" toggle, restore and force-delete in the Blade index and Vue listing.
admin:generate:request:index --template.
Changed
- For soft-deleting models
destroyruns in a transaction andbulkDestroydeletes row by row, so model events and observers fire for bulk deletes too. Integrity constraint violations come back as validation errors. - Long
route(...)lines in the generated controller wrap at 120 characters.
Internal
- Snapshots for a table without soft deletes guard the unchanged output; README and UPGRADE sections.