Skip to content

feat: Table actions - #246

Merged
64knl merged 10 commits into
mainfrom
feat/table-actions
Jul 23, 2026
Merged

feat: Table actions#246
64knl merged 10 commits into
mainfrom
feat/table-actions

Conversation

@64knl

@64knl 64knl commented Jul 23, 2026

Copy link
Copy Markdown
Member

No description provided.

@64knl
64knl requested a review from Copilot July 23, 2026 13:59
@64knl 64knl changed the title Feat/table actions feat: Table actions Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces configurable per-table retention actions (archive/delete/purge) that can be edited in the CMS UI, exported/imported with table definitions, and executed daily via a scheduled job. It also adds a new “purge” capability to asset services/components to support permanent deletion of records and their owned resources (files/rows).

Changes:

  • Add CMS editor UI + routes/controllers/models/enums for table retention actions and persist them in a new cms_table_actions table.
  • Export/import retention actions with table definitions (asset export version bump to 1.4.0) and harden exchange-table rebuild by dropping FK constraints on backup tables.
  • Add “purge” support across asset services/components plus upload sharing support (source_upload_id) to safely clean up files only when no longer referenced.

Reviewed changes

Copilot reviewed 48 out of 48 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Traits/Exchangeable.php Bumps export version and includes table action + new allow flags in exports.
src/Services/Editor/TableActionsEditor.php New CMS UI builder for listing/adding/editing retention actions.
src/Services/CmsExchange/TemplateExchangeService.php Drops foreign keys on renamed backup tables during import rebuild.
src/Services/CmsExchange/TableExchangeService.php Imports/exports table actions; adds allow flags; rebuilds cms_table_actions in import flow.
src/Services/CmsExchange/AbstractExchangeService.php Adds helper to drop foreign keys from backup tables.
src/Services/Assets/TableService.php Adds purge() to permanently remove a record, component-owned resources, and uploads.
src/Services/Assets/TableActionService.php New service to execute retention actions against site tables.
src/Services/Assets/PageService.php Adds purge() to permanently remove page-owned resources and strings.
src/Services/Assets/GlobalPageService.php Adds purge() override that blocks purging global pages.
src/Services/Assets/Enums/TableActionType.php New enum for action types (archive/delete/purge) + CMS labels.
src/Services/Assets/Enums/TableActionCondition.php New enum for retention conditions + timestamp mapping + CMS labels.
src/Services/Assets/Components/ComponentVectorImage.php Implements component-level purge() cleanup.
src/Services/Assets/Components/ComponentTimePicker.php Implements no-op purge() (value stored in record).
src/Services/Assets/Components/ComponentText.php Refactors upload folder usage; adds clone + purge handling for rich-text uploads.
src/Services/Assets/Components/ComponentTags.php Adds purge() to remove record↔tag link rows.
src/Services/Assets/Components/ComponentTableSelect.php Implements no-op purge() (shared referenced rows).
src/Services/Assets/Components/ComponentStaticValue.php Implements no-op purge().
src/Services/Assets/Components/ComponentSlug.php Implements no-op purge().
src/Services/Assets/Components/ComponentNumber.php Implements no-op purge().
src/Services/Assets/Components/ComponentModelSelect.php Implements no-op purge() (shared referenced rows).
src/Services/Assets/Components/ComponentImage.php Makes file deletion resilient to missing sizes; adds purge() to delete generated images.
src/Services/Assets/Components/ComponentHeader.php Implements no-op purge().
src/Services/Assets/Components/ComponentFilter.php Implements no-op purge().
src/Services/Assets/Components/ComponentFile.php Adds purge() and implements actual file deletion helper.
src/Services/Assets/Components/ComponentEditorLink.php Implements no-op purge().
src/Services/Assets/Components/ComponentDropDown.php Implements no-op purge() (shared referenced rows).
src/Services/Assets/Components/ComponentDescription.php Implements no-op purge().
src/Services/Assets/Components/ComponentDefault.php Implements no-op purge() fallback.
src/Services/Assets/Components/ComponentDateTimePicker.php Implements no-op purge().
src/Services/Assets/Components/ComponentDatePicker.php Implements no-op purge().
src/Services/Assets/Components/ComponentCustomSelect.php Implements no-op purge().
src/Services/Assets/Components/ComponentContentBlocks.php Adds purge() to remove content blocks and purge their target records.
src/Services/Assets/Components/ComponentCombobox.php Implements no-op purge().
src/Services/Assets/Components/ComponentChildTable.php Adds purge() to purge child rows (including previously deleted).
src/Services/Assets/Components/ComponentCheckbox.php Implements no-op purge().
src/Services/Assets/Components/ComponentButton.php Implements no-op purge().
src/Services/Assets/Components/AbstractComponent.php Adds new required abstract purge() API for components.
src/Services/Assets/AbstractAssetService.php Adds new required abstract purge() API for asset services.
src/Models/TableAction.php New model for cms_table_actions with enum casts and relation to Table.
src/Models/Table.php Adds actions() relation and adds purgeRecord() for hard deletes.
src/Models/FileUpload.php Adds source_upload_id fillable/docs to support shared uploads across duplicates.
src/Jobs/RunTableActions.php New queued job to run table retention actions daily (unique job).
src/Http/Controllers/CmsEditor/CmsEditorTableController.php Adds the retention actions widget to the table editor page.
src/Http/Controllers/CmsEditor/CmsEditorTableActionController.php New controller to create/read/update/delete retention actions.
src/FrameworkServiceProvider.php Registers artisan command and daily schedule for running table actions.
routes/cms/editor.php Adds editor routes for table actions under /action.
database/migrations/2026_07_23_000001_add_source_upload_id_to_cms_uploads_table.php Adds source_upload_id to support shared-upload lifecycle.
database/migrations/2026_07_23_000000_create_cms_table_actions_table.php Creates cms_table_actions table schema.
Comments suppressed due to low confidence (2)

src/Services/Editor/TableActionsEditor.php:96

  • $action is nullable in addInputs(), but $action->days ?? 30 will still throw when $action is null because it attempts to access a property on null. Use the nullsafe operator so new-action defaults work.
    src/Services/Editor/TableActionsEditor.php:104
  • $action is nullable in addInputs(), but $action->action->value ?? ... will throw when $action is null. Use the nullsafe operator so the default action is selected when adding a new rule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Services/Assets/Components/ComponentFile.php Outdated
Comment thread src/Services/Editor/TableActionsEditor.php Outdated
Comment thread src/Services/Assets/TableActionService.php Outdated
64knl and others added 6 commits July 23, 2026 16:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@64knl
64knl merged commit ade6810 into main Jul 23, 2026
3 of 4 checks passed
@64knl
64knl deleted the feat/table-actions branch July 23, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants