Laravel EnsoLaravel Enso
Guide
Back End
Front End
GitHub
Guide
Back End
Front End
GitHub
  • Back End

    • Action Logger
    • Addresses
    • Algolia
    • Algolia Webshop
    • API
    • Audits
    • Avatars
    • Cache Chain
    • Calendar
    • Cargo Partner
    • Categories
    • Charts
    • CI/CD
    • Cli
    • CNP Validator
    • Comments
    • Commercial
    • Companies
    • Core
    • Countries
    • Currencies
    • Data Export
    • Data Import
    • Discounts
    • Documents
    • Dynamic Methods
    • EAV
    • Emag
    • Enums
    • Excel
    • Facebook
    • Files
    • Filters
    • Financials
    • Forms
    • Frisbo
    • Google
    • Helpers
    • Holidays
    • How-to
    • Image Transformer
    • Impersonate
    • Interactions
    • Inventory
    • IO
    • Localisation
    • Lockable Models
    • Logs
    • Measurement Units
    • Meili Search
    • Meili Search Webshop
    • Menus
    • Migrator
    • Monitored Emails
    • Notifications
    • Packaging Units
    • PDF
    • People
    • Permissions
    • Product Eav
    • Product Lots
    • Products
    • Questionnaires
    • Rememberable
    • Roles
    • Sale Channels
    • Searchable
    • Select
    • Sentry
    • Services
    • Smart Bill
    • Sms Advert
    • Stripe
    • Tables
    • Tasks
    • Teams
    • Ticketing
    • Track Who
    • Tutorials
    • Typesense
    • Typesense Webshop
    • Unit Conversion
    • Upgrade
    • UPS
    • User Groups
    • Users
    • Versions
    • Virtual Call Center
    • Vouchers
    • Webshop
    • Webshop Commercial

Audits

LicenseStableDownloadsPHPIssuesMerge Requests

Description

Audits records model create, update, and delete events across monitored Eloquent models and exposes them through an Enso table endpoint.

The package auto-registers a model observer for all auditable models discovered under the configured vendor roots, stores before/after change payloads in the audits table, and publishes the backend routes consumed by the matching frontend audits page.

Installation

Install the package:

composer require laravel-enso/audits

Run the package migrations:

php artisan migrate

The package auto-discovers its service providers. In applications that need to narrow the monitored model set, extend LaravelEnso\\Audits\\AuditServiceProvider in the host app and register the custom provider in bootstrap/providers.php.

Features

  • Automatically observes auditable models discovered under the configured vendor directories.
  • Stores created, updated, and deleted events together with before/after payloads.
  • Supports restricted auditing through the RestrictedAuditable contract.
  • Publishes table-init, table-data, export, and options endpoints under api/system/audit.

Usage

Mark a model as auditable:

use Illuminate\Database\Eloquent\Model;
use LaravelEnso\Audits\Contracts\Auditable;

class Invoice extends Model implements Auditable
{
}

Limit the recorded attributes:

use Illuminate\Database\Eloquent\Model;
use LaravelEnso\Audits\Contracts\RestrictedAuditable;

class Invoice extends Model implements RestrictedAuditable
{
    public function auditableAttributes(): array
    {
        return ['status', 'total'];
    }
}

By default, the package scans all vendor folders listed in config('enso.audits.vendors') and the application namespace for models that implement the auditing contracts.

API

Main route group

Mounted under api/system/audit:

  • system.audit.initTable
  • system.audit.tableData
  • system.audit.exportExcel
  • system.audit.options

Contracts

  • LaravelEnso\\Audits\\Contracts\\Auditable
  • LaravelEnso\\Audits\\Contracts\\RestrictedAuditable

Core classes

  • LaravelEnso\\Audits\\Observers\\ModelObserver
  • LaravelEnso\\Audits\\Models\\Audit
  • LaravelEnso\\Audits\\Services\\AuditableModels

Depends On

Required Enso packages:

  • laravel-enso/tables ↗
  • laravel-enso/track-who ↗

Companion frontend package:

  • @enso-ui/audits ↗

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

License

MIT

Edit this page on GitHub
Last Updated: 4/21/2026, 11:24:41 AM
Prev
API
Next
Avatars