- What does a2zwebltd/auditable-relations do?
- It adds automatic auditing for Eloquent relationship changes in Laravel applications. Specifically, it records attach, detach, and sync operations through Laravel Auditing so pivot changes are captured in your audit trail. It is aimed at teams that already use Laravel Auditing and want relationship-level visibility.
- How do I install a2zwebltd/auditable-relations?
- Install the package with Composer using composer require a2zwebltd/auditable-relations. Then follow the package README for any required configuration or migration steps. Because it builds on Laravel Auditing, make sure Laravel Auditing is already installed and configured in your application.
- Which Laravel versions are supported by a2zwebltd/auditable-relations?
- The package is built for Laravel applications that use Laravel Auditing. Exact Laravel and PHP version constraints can change between releases, so check the composer.json and README in the GitHub repository before installing. That will confirm compatibility with your application's framework version.
- Does it audit attach, detach, and sync operations?
- Yes, the package is specifically designed to audit Eloquent relationship attach, detach, and sync changes. Those operations are the core use case described by the package. You should still verify the exact event coverage in the README for your version.
- How does it integrate with Laravel Auditing?
- It works alongside Laravel Auditing rather than replacing it, using your existing audit setup to store relationship changes. You keep Laravel Auditing configured on your auditable models and then enable the relationship auditing behavior provided by this package. Review the README for the precise integration steps.
- Do I need to modify my Eloquent models to audit relationships?
- You will need to enable the package according to its documentation and ensure the relevant models are already auditable with Laravel Auditing. The package is intended to fit into your existing Eloquent models rather than requiring a separate relationship model. Check the README for the exact traits, configuration, or model changes required.
- How are relationship changes stored in the audit records?
- Relationship changes are stored through Laravel Auditing in your application's audit table, using the same auditing infrastructure as other model audits. The audit entry should capture the relationship operation, such as attach, detach, or sync, along with the related model information. Inspect the package source or README if you need the exact payload format.
- Is a2zwebltd/auditable-relations safe to use in production?
- It is intended for production Laravel applications that need audit trails for relationship changes. Before adopting it, review the repository's tests, release history, and open issues, and test it against your own models and database. Audit logging adds writes, so also consider the performance impact on high-volume sync operations.
- How do I test relationship auditing in Laravel?
- Write feature tests that attach, detach, or sync related models and then assert that the expected audit records were created. Use a test database and Laravel's testing helpers so the audit assertions run against real Eloquent behavior. Check the package README for any testing-specific configuration or helpers.
- What are alternatives to a2zwebltd/auditable-relations?
- You can implement relationship auditing manually with Eloquent model events and Laravel Auditing, or use another audit package that supports pivot changes. This package is focused specifically on automating attach, detach, and sync audits with Laravel Auditing. Compare the maintenance activity and Laravel version support of any alternative before switching.