chondal/model-history

在模型中保存操作历史。

0.0.2 2021-09-27 13:30 UTC

This package is auto-updated.

Last update: 2024-09-27 20:18:55 UTC


README

在模型中创建和显示自定义历史记录。

安装

composer require chondal/model-history

然后执行迁移以迁移 "notes" 表

依赖项

此包使用了以下包

composer require laracasts/flash

如何使用

发布名为 history.php 的配置文件。配置要保存的模型作者,通常是 user 模型。

在将使用历史的模型中使用随包提供的 HasHistory trait。

示例

use SoftDeletes;
use HasHistory;

protected $guarded = [];

当您想在一个模型中显示历史记录时,例如在编辑同一模型的屏幕上,您可以调用以下方法。

composer require laracasts/flash

{{ ModelHistory::table($model) }} 其中 $model 是您要查看的当前模型实例。

这将列出历史记录。

贡献

此包正在开发中。

许可证

MIT