定制 patipark/yii2-log-field 二次开发

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

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

patipark/yii2-log-field

Composer 安装命令:

composer require patipark/yii2-log-field

包简介

ใช้ในการเก็บ Log ของ Active Record Model โดยเก็บเฉพาะฟิวดที่เปลียนแปลงเท่านั้น และแปลงข้อมูลเป็น string ทั้งหมดก่อนเก็บลง Log

README 文档

README

ใช้ในการเก็บ Log ของ Active Record Model โดยเก็บเฉพาะฟิวดที่เปลียนแปลงเท่านั้น และแปลงข้อมูลเป็น string ทั้งหมดก่อนเก็บลง Log

Installation

The preferred way to install this extension is through composer.

Either run

php composer require patipark/yii2-log-field "dev-master"

or add

    "require": {
        ......
        "patipark/yii2-log-field": "dev-master"
        ......
    }

to the require section of your composer.json file.

Apply migrations เสร็จแล้วจะสร้างตารางชื่อว่า yii2_log เพื่อเก็บ Log

yii migrate/up --migrationPath=@vendor/patipark/yii2-log-field/migrations

Configure the behavior

class YourModel extends \yii\db\ActiveRecord
{
    public $ignoreLogAttributes = ['created_by', 'created_at', 'updated_by', 'updated_at'];
    
    public function behaviors()
    {
        return [
            \patipark\yii2logfield\LogBehavior::class,
            ......
            ......
        ];
    }

attributes ที่ไม่ต้องการเก็บ log

ให้ประกาศตัวแปร ไว้ใน model ขื่อว่า $ignoreLogAttributes แต่ถ้าไม่ได้ประกาศไว้ จะเก็บ log ทุกฟิวด์

public $ignoreLogAttributes = ['created_by', 'created_at', 'updated_by', 'updated_at'];

การทำงาน

ข้อมูลจะเก็บในตารางชื่อ yii2_log_field และเก็บข้อมูลของแต่ละฟิวด์ไว้ 1 record ต่อการเปลียนแปลง 1 ฟิวด์ โดยเก็บค่า before_change,after_change,table_name,field_name,primary_key etc............

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固