sureyee / laravel-action-log
基于ORM模型事件的操作记录
v1.0
2019-05-22 14:58 UTC
Requires
- php: >=7.1
- laravel/framework: ^5.5|^5.6|^5.7
This package is auto-updated.
Last update: 2025-03-23 05:12:37 UTC
README
项目介绍
基于ORM模型的操作记录工具包
注意:由于使用的orm模型事件,因此在批量更新的时候是不会触发操作日志记录的。
安装说明
-
安装接口包
composer require sureyee/laravel-action-log
-
运行
php artisan vendor:publish
发布配置项文件
使用说明
- 在
actionlog.php
中配置需要监听的模型return [ 'watching' => [ \App\Models\User::class ] ];
- 在注册的模型中添加
trait
use Sureyee\ActionLog\Traits\ActionLogAble; class User extends Authenticatable { use Notifiable, HasApiTokens, SoftDeletes, HasRolesAndAbilities, ActionLogAble; }
排除字段
如果有些冗余字段不需要进行监听则可以加入到$excepts
数组中,在更新操作时,会忽略该字段的值,如果只有忽略值更新,则不会进行记录。
class User extends Authenticatable { protected $excepts = ['updated_at', 'created_at']; }