dentorus/model-log-2
最新稳定版本:v1.0.1
Composer 安装命令:
composer require dentorus/model-log-2
包简介
Voyager Model Log
README 文档
README
Install hook
composer require dentorus/model-log-2
Enable hook
php artisan hook:enable dentorus/model-log-2
Publishing config
php artisan vendor:publish --provider="Dentorus\ModelLog\ModelLogServiceProvider"
How to use Model logging
Voyager Model Log is used to observe any changes in the model via writing it in the "model-log" table in your database.You can use it, simply adding "use ModelLogging;" in your model.
Example:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Dentorus\ModelLog\Traits\ModelLogging;
class Post extends Model
{
use ModelLogging;
}
If you want to exclude or include the changes in the model's field, just remove or add the field from model's "$logFields" property
Example:
$logFields = ['title'];
If you want to differently display "user" field in the "model-log" table, add "getLogNameAttribute" property to your User model.
Example:
public function getLogNameAttribute()
{
return $this->firstname . " " . $this->lastname;
}
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-06