samuell/revisions-plugin

Revisions 允许扩展任何带有 Revisionable 特性的模型,添加更多功能和易于使用。

1.2.1 2022-04-09 12:35 UTC

This package is auto-updated.

Last update: 2024-09-05 18:05:44 UTC


README

Revisions 允许扩展任何带有 Revisionable 特性的模型。它提供了更多功能且易于使用。

扩展 OctoberCMS 核心特性 Revisionable: https://octobercms.com/docs/database/traits#revisionable

https://octobercms.com/plugin/samuell-revisions

用法

通过 Revisions 特性扩展模型。

class MyModel {
    use \Samuell\Revisions\Traits\Revisions;

    /**
     * @var array Monitor these attributes for changes.
     */
    protected $revisionable = ['name', 'email'];

}

向我们的表单配置添加新的小部件

history:
    label: History of changes
    span: full
    disabled: true
    type: revisionhistory
    recordsPerPage: 10
    readOnly: false

显示变更的关系

默认情况下,当您使关系可修订时,仅显示变更的 ID。要显示标题或名称,可以将以下字段添加到父表单中。

category_id:
    hidden: true
    revisions:
        relation: Acme\Plugin\Models\Category
        nameFrom: name # 'name' is the default