tochka-developers/model-history
Composer 安装命令:
composer require tochka-developers/model-history
包简介
Simple history for Laravel models
README 文档
README
Easily add keeping track of model modifications.
Installation
-
Add
"tochka-developers/model-history":"^0.1"to therequiresection of yourcomposer.json -
Publish package assets:
php artisan vendor:publish
-
You may now edit the config file
model-history.phpto specify the name of the table to store history records. Please do it before running the migrations. Default name ishistorywhich is quite reasonable. -
Use
\Tochka\ModelHistory\HasHistorytrait in your model.
History structure
History records for all tracked models are stored in the same table
specified in the config file (history is the default name).
Each record contains the following data:
changed_at- time of modification;entity_name- name of the table containing tracked model records;entity_id- ID of the row in the tracked table the history entry relates to;action- type of modification. The possible values arecreate,update,deleteandrestore.new_data- a JSON containing new values. Therefore each history record is essentially a diff to the previous version of the model.
Warning
The history table always grows and is NEVER CLEANED UP by this package. Please consider the possibility of the history table becoming the largest in your database and occupying more space than all other tables ultimately exhausting all available disk space.
统计信息
- 总下载量: 2.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-04-28