forex-formula/yii2-log
Composer 安装命令:
composer require forex-formula/yii2-log
包简介
Package
关键字:
README 文档
README
Installation
The preferred way to install this extension is through composer.
Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json. Either run
$ php composer.phar require pvsaintpe/yii2-log "5.*"
or add
"pvsaintpe/yii2-log": "5.*"
to the require section of your composer.json file.
Additional information
All base models and query must be inherited from:
ActiveRecord extends \pvsaintpe\log\components\ActiveRecord
ActiveQuery extends \pvsaintpe\log\components\ActiveQuery
To track changes, add to your model:
/** * @return bool */ public static function logEnabled() { return true; }
Build project
Every time when you change the database schema to be logged, run the command:
#!/usr/bin/env bash
php ./yii changelog/generate
php ./yii changelog/migrate --interactive=0
Customization
- To access the visual part, for example, to view revisions and change history of your data, add to the config:
// backend/configs/main.php return [ 'modules' => [ 'changelog' => [ 'class' => 'pvsaintpe\log\Module', ], ] ];
- To fine-tune the logging system, use the configurator. For a complete list of available options, see pvsaintpe\log\components\Configs:
// common/configs/params.php return [ 'changelog.configs' => [ 'db' => 'dbLog', // DB Storage for Log-tables 'storageDb' => 'db', // DB Storage for Data-tables 'adminTable' => 'admin', // Table Name for Admin's 'tablePrefix' => '_log', 'adminColumn => 'updated_by', ], ];
Usage
To activate all features of the component, use pvsaintpe\log\traits\SearchTrait in your Search-models. It is recommended to keep the log data in a separate database, although you are not limited in this.
统计信息
- 总下载量: 813
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-30