aedart/athenaeum-audit

Laravel Eloquent 审计跟踪包


README

为 Laravel Eloquent 模型提供的一个审计跟踪包。它能够将给定模型上所做的更改存储到“审计跟踪”表中,包括已更改的属性。

示例

namespace Acme\Models;

use Illuminate\Database\Eloquent\Model;
use Aedart\Audit\Traits\RecordsChanges;

class Category extends Model
{
    use RecordsChanges;
}

在您的应用程序中稍后...

$category = Category::create( [ 'name' => 'My category' ]);

// Obtain the "changes" made (in this case a "create" event) 
$changes = $category->recordedChanges()->first();

print_r($changes->toArray());

// Example output:
//    [
//      "id" => 1
//      "user_id" => null
//      "auditable_type" => "Acme\Models\Category"
//      "auditable_id" => "24"
//      "type" => "created"
//      "message" => "Recording created event"
//      "original_data" => null
//      "changed_data" => [
//        "name" => "My Category"
//        "id" => 1
//      ]
//      "performed_at" => "2021-04-28T11:07:24.000000Z"
//      "created_at" => "2021-04-28T11:07:24.000000Z"
//    ]

文档

请阅读官方文档获取更多信息。

仓库

单仓库位于 github.com/aedart/athenaeum

版本控制

此包遵循 语义版本控制 2.0.0

许可证

BSD-3-Clause,请阅读包含在此包中的 LICENSE 文件