How owen-it/laravel-auditing works
Main Components
a) Core Auditing System:
• AuditableObserver that watches for model changes
• Auditable trait that models can implement
b) Driver System:
• Database driver as the default storage mechanism
• An extension point for custom drivers
• To the database storage (audits table)
c) Resolver Components:
• Resolvers (IP, URL, UserAgent, User)
• How they feed information into the audit records
d) Event System:
• Event flow (Auditing → Audited → DispatchAudit)
• Event listeners and their connections
Relationship Flow
Laravel Application
• ↓
Auditable Models → AuditableObserver
• ↓
Auditor (Core)
• ↓
Event Dispatcher
• ↙ ↘
Resolvers Drivers
• ↘ ↙
• Audit Storage
Implementation Details to Highlight
a) Contract Layer:
• Interfaces in src/Contracts as a separate layer
b) Support Systems:
• Attribute modifiers (encoders, redactors)
• Console commands as administrative tools
Specific Elements
• Audit lifecycle (pre-audit → audit → post-audit)
• Extension points for custom implementations
• Configuration flow from config/audit.php