codestepsbd/historykeeper

这将捕获选定表中的插入、更新和删除数据

dev-master 2024-05-06 17:44 UTC

This package is auto-updated.

Last update: 2024-09-06 18:22:12 UTC


README

Laravel HistoryKeeper 包提供了管理 Laravel 应用程序中历史表和触发器的功能。它允许您轻松创建、更新和管理历史表和触发器。

安装

您可以通过 Composer 安装此包。在终端中运行以下命令

composer require codestepsbd/historykeeper:dev-master

数据库迁移

安装后,您必须运行迁移以创建 table_history_with_settings 表。

您可以使用 Laravel 的迁移命令运行迁移

php artisan migrate

用法

命令

该包提供了一个控制台命令 app:update-history-tables-and-triggers,具有多个选项

  • --makeNewHistoryTable=false:如果设置为 true,则创建新的历史表。
  • --runTest:运行测试以了解包是否正常工作。
  • --scanMismatch:扫描基本表与其历史表之间的不匹配。

您可以使用如下选项使用该命令

php artisan app:update-history-tables-and-triggers --makeNewHistoryTable=true --runTest --scanMismatch

路由

该包在 history-keeper 前缀下定义了几个路由

  • /:显示历史数据的索引页面。
  • /url-command/{value?}:提供一个命令 URL 端点。这里的值可以是 runTest 用于运行测试、true 用于创建历史表和 scanMismatch 用于在网页浏览器上扫描基本表与其历史表之间的不匹配。

中间件

可以使用 config("historyKeeper.middleware") 配置将中间件应用于 history-keeper 路由。

许可证

此包是开源软件,许可协议为 MIT 许可

请根据您包的特定细节和需求进行自定义。