Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Auditing

Laravel Auditing Laravel Package

owen-it/laravel-auditing

Track and review changes to your Laravel Eloquent models with minimal setup. Laravel Auditing stores a history of model events and attribute diffs, helping detect anomalies and providing easy access to audit logs for display, reporting, and investigation.

View on GitHub
Deep Wiki
Context7

Audit changes of your Eloquent models in Laravel

Frequently asked questions about Laravel Auditing
How do I start auditing Eloquent models in Laravel with this package?
Add the `Auditable` trait to your Eloquent model and run the migration to create the `audits` table. The package automatically captures create, update, and delete events, including old/new values and timestamps. No extra code is needed for basic usage.
Which Laravel versions does owen-it/laravel-auditing support?
The package supports Laravel 11–13 (PHP 8.2+). Ensure your Laravel version matches the package’s requirements to avoid compatibility issues. Check the [GitHub repository](https://github.com/owen-it/laravel-auditing) for the latest version compatibility.
Can I disable auditing for specific models or fields?
Yes, you can disable auditing globally via config or per-model by setting `auditable = false` in the model. To exclude specific fields, use the `auditable` array in the model to list only the fields you want to track.
How do I query audit logs for a specific model?
Use the `Audit` facade or model to query logs. For example, `Audit::for(Model::class)->where('event', 'updated')->get()` retrieves all updates. The package provides methods like `whereChanged()`, `whereAdded()`, and `whereDeleted()` for granular filtering.
Does this package support custom audit drivers (e.g., Redis or Elasticsearch)?
Yes, the package supports custom drivers via the `AuditDriver` contract. You can implement your own driver for storage backends like Redis or Elasticsearch, though querying may require adjustments compared to the default database driver.
How does performance impact scale with high-frequency model updates?
Auditing triggers on every Eloquent event, which can impact performance for high-frequency operations. Mitigate this by disabling auditing for non-critical models or using a custom driver (e.g., async queue) to offload audit logging.
Can I track soft-deleted models (deleted_at) in audit logs?
Yes, the package captures soft deletes by default. Use methods like `withTrashed()` to query soft-deleted audit records. Hard deletes are also tracked, but you may need to configure this explicitly in your model.
Are there built-in tools for pruning old audit logs?
No, the package doesn’t include a built-in pruning tool, but you can manually delete old logs using Laravel’s scheduler or a custom command. Consider adding a retention policy (e.g., delete logs older than 6 months) to manage storage.
How do I customize the user or metadata stored in audit logs?
Use custom resolvers by implementing interfaces like `UserResolver` or `AttributeResolver`. For example, you can resolve the current user via a custom resolver or add metadata like tenant IDs or IP addresses to every audit entry.
What alternatives exist for Laravel model auditing, and how does this compare?
Alternatives include `spatie/laravel-activitylog` (more feature-rich but heavier) and `laravel-audit-log` (simpler but less flexible). This package stands out for its minimal setup, Laravel-native integration, and focus on granular field-level changes without excessive overhead.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai