prog_1990's avatar

Audit Trail

Can anyone tell me which audit trail is best Laravel auditing or Laravel Activity Log for ERP system developed by using Laravel??? OR

Is there any other Audit Trail???

0 likes
8 replies
bobbybouwmann's avatar

I personally like Laravel Activity Log very much, but it might miss functionalities you need that some other package can offer you.

Depending on your use case you need to decide which package you want to use. Double-check the requirements you need and based on that use the package that fits the best

1 like
Snapey's avatar

spatie/laravel-activitylog

You add the trait to a model you want to monitor and an array of field names that you want monitoring. Thats it.

prog_1990's avatar

But Laravel auditing also does the same thing . Is there any difference between Laravel Auditing and Laravel Activity log?

Snapey's avatar

not sure which other package you are referring to. I was also using spatie roles and permissions, and this one allowed me to record changes to those models also.

prog_1990's avatar

Is there any disadvantage of Laravel Activity Log???

Snapey's avatar
Snapey
Best Answer
Level 122

It really depends what your requirements are. I needed to know if someone was changing roles and permissions of users as a primary requirement.

Using Spatie Roles, I had to implement my own Role model and then audit that.

<?php

namespace App;

use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Permission\Models\Role as SR;

class Role extends SR 
{
    use LogsActivity;

    protected static $logAttributes = ['name', 'guard_name'];

    protected static $logName = 'user';

}

same for Permission.

This package also stores all changes as a json object with old and new arrays of changed fields. If you want to know if a specific field was changed then you have to compare the two arrays. This may not suit your use case. Its fine for me as I just need to keep an audit trail for investigations later.

Please or to participate in this conversation.