mahmoudarafat / edit-history
可编辑和可历史记录的数据,用于CRUD操作以节省请求消耗和带宽,同时记录所有请求中进行的更改的历史。
1.4
2022-11-13 11:04 UTC
Requires
- php: >= 5.3.0
README
可编辑和可历史记录的数据,用于CRUD操作以节省请求消耗和带宽,同时记录所有请求中进行的更改的历史。
特性
- 使用一个模型配置保存您数据库表中所有编辑
- 这将为需要跟踪其编辑历史的任何所选模型创建一个名为(edit_history)的数据库表。
即将推出的特性
- 查看您所有模型中完成的历史记录(您不需要编写代码,我会为您完成)。
作者
安装
首先,我们运行
composer require mahmoudarafat/edit-history
然后,我们应该将包添加到[config/app.php]
'providers' => [
....
\MahmoudArafat\EditHistory\EditHistoryServiceProvider::class,
....
],
现在,我们可以发布包
php artisan vendor:publish
[选择]
MahmoudArafat\EditHistory\EditHistoryServiceProvider
最后,我们执行此Artisan命令以将[edit_history]表添加到您的数据库。
php artisan edithistory:table
就这样,享受吧!
用法/示例
<?php namespace App\Models; // import the package use MahmoudArafat\EditHistory\Traits\Historyable; class User extends Model { // use the package in model use Historyable; }
为自定义忽略的列停止跟踪:在模型中添加[ignoreHistoryColumns]属性
<?php namespace App\Models; // import the package use MahmoudArafat\EditHistory\Traits\Historyable; class User extends Model { // use the package in model use Historyable; // ignore those here public $ignoreHistoryColumns = ['name', 'updated_at']; }