定制 govelid/laravel-multi-auditable 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

govelid/laravel-multi-auditable

最新稳定版本:1.1.5

Composer 安装命令:

composer require govelid/laravel-multi-auditable

包简介

A Laravel package to create flexible auditable migrations and traits

README 文档

README

This package simplifies the management of models that use audit trails, enabling multiple audit tables for each module within your Laravel web application.

Support the Project

If you find this package useful, consider supporting its development:

Support Me

Installation

  1. Install the package via composer:

    composer require govelid/laravel-multi-auditable
  2. Example: Run the following Artisan command to create the necessary files:

    php artisan make:auditable ProjectAuditable

    This will generate:

    • A migration file for the table project_auditables.
    • A Trait file ProjectAuditableTrait.
    • A Model file ProjectAuditable.
  3. Run migration

  4. To add audit trail functionality to the Project model, simply include the trait:

    use ProjectAuditableTrait;

Customization

You can override the following methods in your model for further customization:

Timestamp Attributes

Override the default timestamp attributes (e.g., created_at, updated_at):

protected function getTimestampAttributes()
{
    return ['updated_at', 'created_at'];
}

Audit Record ID

Specify the audit record ID (defaults to id):

public function getAuditRecordId()
{
    return $this->id;
}

Audit Fields Notes

Add custom notes for audit trails:

public function getAuditFieldsNotes()
{
    return $this->id;
}

Audit Fields for Delete

Define the fields to be logged during deletion:

public function getAuditFieldsForDelete()
{
    return ['id'];
}

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-22