oxenti/historic

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

CakePHP 的历史行为

安装: 16

依赖: 1

建议者: 0

安全: 0

星标: 0

关注者: 5

分支: 0

开放问题: 0

类型:cakephp-plugin

dev-master 2015-10-30 17:59 UTC

This package is not auto-updated.

Last update: 2024-09-22 07:53:21 UTC


README

此插件为表添加历史行为

需求

  • CakePHP 3.0+

安装

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

安装 composer 包的推荐方式是

composer require oxenti/historic

配置

在您的应用的 config/bootstrap.php 文件中添加

// In config/bootstrap.php
Plugin::load('Historic');

或者使用 cake 的控制台

./bin/cake plugin load Historic

在您的应用的模型中,在 initialize 方法中添加 Histotic 行为

    ...
     $this->addBehavior('Historic.Historic'[
        'class' => 'Historic`s table'
        'fields' => ['fields']//fields that should be saved on historic table
    ]);
    ...

配置文件[可选]

将插件配置文件夹中的 'address.php' 配置文件移动到您的应用配置文件夹中。

在您的应用的 'bootstrap.php' 文件中添加地址配置文件

    ...
    try {
	    Configure::config('default', new PhpConfig());
	    Configure::load('app', 'default', false);
	} catch (\Exception $e) {
	    die($e->getMessage() . "\n");
	}

	Configure::load('historic', 'default');
    ...

警告

Historic 的表需要字段是_active tinyInt(1)。