zaengle/audits

A package to manage model audits
7,878 2
Install
composer require zaengle/audits
Latest Version:v5.0.0
PHP:^8.1|^8.2|^8.3
License:MIT
Last Updated:Jun 25, 2026
Links: GitHub  ·  Packagist
Maintainer: jesseschutt

Tests Latest Version on Packagist Total Downloads MIT Licensed

audit header

Audits

This packages records changes to a Laravel model and stores them in a json column on the model.

Usage

Use the MakesAudits trait on your model.

Next add a nullable json column to your model. By default the package will look for a column called audits. To override the auditable column, change the $auditableColumn property on your model.

protected $auditableColumn = 'audits';

Finally add a json cast for the auditable column.

protected $casts = [
    'audits' => 'json',
];

This is all you need to get started. The package will automatically record changes to the model and store them in the audits column.

If you ever need to save arbitrary data to the audit log you may do so by calling the manualAudit method.

$model = Model::find(1);

$model->manualAudit([
    'field' => 'value',
]);

Occasionally you may want to bypass writing to the audit log. In those cases you can override the shouldTriggerAudit function on your model like so:

// MyModel.php

public function shouldTriggerAudit(): bool
{
    return $someCondition ? true : false;
}

Attributions

If you are looking for a more robust solution, this package is worth checking out: Laravel Auditor

Related Packages

jeylabs/laravel-audit-log

A very simple audit logger to monitor the users of your website or application

5,501 6
somnambulist/laravel-doctrine-entity-audit

A port of the SimpleThings EntityAudit package re-worked for Laravel 5+

6,002 4
venturecraft/revisionable

Keep a revision history for your models without thinking, created as a package f...

7,369,764 2,615
delatbabel/applog

Laravel applicaton and audit logging package.

2,047 4