kamel/laravel-auditable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kamel/laravel-auditable

最新稳定版本:v0.0.1

Composer 安装命令:

composer require kamel/laravel-auditable

包简介

README 文档

README

A Laravel package that provides automatic auditing for Eloquent models.

Package Installation

1. Install Package

composer require kamel/laravel-auditable

Usage

Basic Usage

Add the Auditable trait to any Eloquent model:

<?php

namespace App\Models;

use Kamel\Auditable\Traits\Auditable;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use Auditable;

    protected $fillable = ['name', 'email', 'password'];
}

How It Works

Once the trait is added, all Eloquent operations are automatically audited:

// Creating a user - triggers audit
$user = User::create([
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);

// Updating a user - triggers audit
$user = User::find(1);
$user->name = 'Jane Doe';
$user->save();

// Mass update - triggers audit
User::where('id', 1)->update(['email' => 'jane@example.com']);

Event Handling

The package dispatches AuditWasTriggered events. Listen for them.

Audit Data Structure

Each audit record contains:

  • model_type: The audited model class
  • model_id: The model's primary key
  • old_values: JSON of previous values
  • new_values: JSON of new values
  • user_type: User model class (if authenticated)
  • user_id: User ID (if authenticated)
  • url: Request URL

Development Setup

Build Docker Container

make build

Run Tests

make test

Clean Environment

make clean

Available Make Commands

  • make build - Build the Docker container
  • make test - Run the test suite with testdox output
  • make clean - Remove Docker containers and images

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固