定制 igor-tv/oc-revisionable-behavior 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

igor-tv/oc-revisionable-behavior

Composer 安装命令:

composer require igor-tv/oc-revisionable-behavior

包简介

Revisionable behavior for extending OCMS models

README 文档

README

Revisionable behavior for extending any OctoberCMS models. This can be used instead Revisionable trait when you need to extend a third party model.

Installation

Run the command below in the root folder of your project:

composer require igor-tv/oc-revisionable-behavior

Use Example

\RainLab\User\Models\User::extend(function ($model) {
    $model->implement[] = 'Iweb.Behaviors.RevisionableModel';

    $revisionableFields = [
        'name',
        'email'
    ];
    
    //required
    $model->addDynamicProperty('revisionable', $revisionableFields);
    
    //optional, default: 500
    $model->addDynamicProperty('revisionableLimit', 200);
    
    //optional, if you need rename revisions model relation
    $model->addDynamicProperty('revisionHistoryRelationName', 'your_history_relation_name');
    
    //optional, if you need assosiate changes with backend users
    $model->addDynamicMethod('getRevisionableUser', function () {
        if (!\BackendAuth::check()) {
            return null;
        }
  
        return \BackendAuth::getUser()->id;
    });
});

For more details see Revisionable trait description https://octobercms.com/docs/database/traits#revisionable

Extending Models in official documentation https://octobercms.com/docs/database/model#extending-models

统计信息

  • 总下载量: 62
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2021-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固