ghonaim / filament-audit-logger
Production-ready audit & activity logger plugin for FilamentPHP v3 — tracks Eloquent model changes and admin panel user activity.
Requires
- php: ^8.2
- filament/filament: ^3.2
- illuminate/contracts: ^10.0|^11.0|^12.0|^13.0
- maatwebsite/excel: ^3.1
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.13
- nunomaduro/collision: ^7.0|^8.0
- orchestra/testbench: ^8.0|^9.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
This package is not auto-updated.
Last update: 2026-08-25 00:04:51 UTC
README
Production-ready audit logging for FilamentPHP v3. Tracks Eloquent model create/update/delete/restore events and admin panel activity, zero external logging dependency.
Installation
composer require ghonaim/filament-audit-logger php artisan vendor:publish --tag="filament-audit-migrations" php artisan migrate php artisan vendor:publish --tag="filament-audit-config"
Register the plugin in your panel provider:
use Ghonaim\FilamentAuditLogger\FilamentAuditLoggerPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentAuditLoggerPlugin::make(), ]); }
Usage
Attach the trait to any model you want tracked:
use Ghonaim\FilamentAuditLogger\Traits\HasFilamentAudit; class Invoice extends Model { use HasFilamentAudit; // Optional per-model overrides: protected array $auditEvents = ['created', 'updated', 'deleted', 'restored']; protected array $auditExclude = ['internal_notes']; protected array $auditInclude = []; // whitelist; empty = all attributes }
Browse Audit Logs in the admin nav. Filter by user, action, model type,
date range, IP. Click a row to open the diff view (old vs new values,
side by side, changed fields highlighted).
Configuration
See config/filament-audit.php — retention window, critical actions,
navigation placement, export disk, globally excluded attributes
(password, tokens, etc. are stripped by default), and the authorization
gate name (view-audit-logs).
Bind the gate in an AuthServiceProvider:
Gate::define('view-audit-logs', fn ($user) => $user->isAdmin());
Pruning
php artisan audit:prune # uses config retention_days
php artisan audit:prune --days=30
php artisan audit:prune --dry-run
Auto-scheduled daily at 02:00 when prune.auto_schedule is true.
Export
Use the "Export" header action on the Audit Logs table (CSV/Excel). The
export dispatches ExportAuditLogsJob onto the queue — configure
QUEUE_CONNECTION for real async behavior; the file lands on the disk set
in filament-audit.export.disk.
Customization
- Swap the diff view: publish
resources/views/vendor/filament-auditand editcomponents/diff-viewer.blade.php. - Add custom metadata per model by overriding
auditMetadata(). - Change the acting-user guard via
filament-audit.user_guard.