Accountant is a Laravel accountably package for your Eloquent models by developer Quetzy Garcia. This package is a convenient way to keep track of Eloquent model changes:
Data discrepancies that may indicate business concerns suspect activities, and other actions that would otherwise pass unnoticed, can now be easily spotted.
At the time of writing, here are the key features according to the README:
- Many-to-many (
BelongsToMany
andMorphToMany
) relation support; - Event source style approach, by keeping complete snapshots of
Recordable
models when created, modified or retrieved; - Ability to recreate
Recordable
model instances in the exact state they were in when recorded; - Signed
Ledger
records for data integrity; - Effortless data integrity checks
- Recording contexts
- Huge customisation support
- Easy to follow documentation and troubleshooting guide;
- Laravel and Lumen 5.2+ support;
This package has a ton of features you can check it in the documentation. Here’s an example of the “Recordable” trait used to record model events:
<?php
namespace App\Models;
use Altek\Accountant\Contracts\Recordable;
use Illuminate\Database\Eloquent\Model;
class Article extends Model implements Recordable
{
use \Altek\Accountant\Recordable;
// ...
}
Accountant released v1.1.0 on January 1st, which introduced Many-to-many relationships, and forceDelete
event support. You can even track pivot events – check the recordable model setup documentation for details on recording pivot events.
You can follow along with Accountant and view the source code on GitLab at Altek / Accountant, including the documentation which is available under version control in the same GitLab repository.
0 comments:
Post a Comment
Thanks