Laravel-activitylog by spatie is awesome.But you may also create your custom activity logs much faster,better,flexible using cool eloquent as you want as per your use cases/ requirements. Happy coding !! :)
Laravel Auditing
I am looking to deploying auditing in one of my Laravel applications.
My application downloads data from a 3rd party party API and saves it locally. In the event, it is going to update a record (say an account), I would like that the "old" data to be saved for historical purposes while keeping the latest data in the table.
I've narrowed my search down to two packages; laravel-activitylog and laravel-auditing. I love what spatite has done for the community and the amount of packages he has developed. I am leaning toward laravel-auditing because I really like the audits Eloquent relationship.
laravel-activitylog - https://docs.spatie.be/laravel-activitylog/v2 laravel-auditing - http://www.laravel-auditing.com
I wanted to put this out there and get some feedback.
Have you used either package? What were your thoughts? Is there a package I missing? Am i going about this auditing the right way? Is there a better way?
I do something similar except I use mysql database triggers. Whenever something gets updated, it copies the old data to a history table before the new data gets updated. It's very fast because, like a stored procedure, it lives IN the database and is automatic. You can create different triggers for insert/update/delete events (think of it like a laravel database event).
No package will be as fast (or as easy) as a native trigger.
Then I just create a 'history' relationship for those tables that have the triggers, so I can just do Model::with('history')->get().
Please or to participate in this conversation.