mazba/cake-simple-model-history

该包最新版本(dev-master)没有提供许可证信息。

CakePHP的CakeSimpleModelHistory插件(mazba.github.io)

安装: 52

依赖项: 0

建议者: 0

安全: 0

星标: 4

关注者: 2

分支: 0

开放问题: 0

语言:CSS

类型:cakephp-plugin

dev-master 2016-12-20 09:15 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:32:09 UTC


README

安装

您可以使用composer将此插件安装到您的CakePHP应用程序中。

在您的应用程序的composer.json中添加以下行

    "require": {
       "mazba/cake-simple-model-history": "dev-master"
    }	

然后执行命令:composer update

或者

安装composer包的推荐方法是

    composer require "mazba/cake-simple-model-history:dev-master"	

设置

config/bootstrap.php中添加

    Plugin::load('CakeSimpleModelHistory', ['bootstrap' => false, 'routes' => true]);

或者使用CakePHP的控制台

    ./bin/cake plugin load CakeSimpleModelHistory

配置

将以下行添加到您的AppController中

    use CakeSimpleModelHistory\Controller\ActivityLogsTrait;

在您的AppController类内部添加以下内容

    class AppController extends Controller
    {
        use ActivityLogsTrait;
    }

最后,您还需要在包上运行迁移

    cake migrations migrate -p CakeSimpleModelHistory

使用以下方式将行为附加到您想要的模型中

    public function initialize(array $config) {
        $this->addBehavior('CakeSimpleModelHistory.ActivityLogs');
    }

查看历史记录:/cake-simple-model-history