To install it you need to add this in your composer.json file
"repositories": {
"eloise/laravel-data-audit": {
"type": "vcs",
"url": "https://github.com/EloisePHP/laravel-data-audit-package"}
},
and then
composer require eloise/laravel-data-audit
This package allows you to audit every action done with a Model you chose.
Once installed for every Model in you project you want to Audit you should make it implement the contract AuditableModel and use the trait AuditableModelTrait like this:
class DefaultAuditableModel extends Model implements AuditableModel
{
use AuditableModelTrait;
And that's it! Everytime someone creates, edits or deletes this model it will be audited and you can check it in the eloise_audit table.
It has the feature of Rollback any auditable Model to the time of your choice, for example
$retrievesPost = Rollback::forModel($post)
->atDate(Carbon::now()->subDay())
->retrieve();
Or if you just want to see the first Post created
$retrievesPost = Rollback::forModel($post)
->retrieve();
If you show this package to anyone out there it would help me a ton.
All tests are made with Orchestra Testbench.
- Spatie Activity Log is a great package done by Spatie. The main difference with Spatie's package is that it is focused on user activity.
The MIT License (MIT). Please see License File for more information.