laravel-auditing icon indicating copy to clipboard operation
laravel-auditing copied to clipboard

Is there a way to set user_id of audits table to null or other user_id

Open bili-ryan opened this issue 4 years ago • 1 comments
trafficstars

Q A
Bug? no
New Feature? no
Framework Laravel
Framework version 6.20.6
Package version 9.3.2
PHP version 7.3.23

Expected Behaviour

When user create model A, "system" automatically creates model B. The audit table then recorded the model B was created by A, not system.

However, the user wouldn't know that on the audit log he created model B. (Cuz in fact he only created model A by himeself.)

Is there a way to storage user_id into audits table without using Auth::guard()? A way to directly storage user_id into audits table? Much appreciated

bili-ryan avatar May 18 '21 10:05 bili-ryan

You could put some flag on model B, so with transformAudit() you remove user_id when the flag is setted

PaolaRuby avatar Jun 24 '22 21:06 PaolaRuby

closed due to inactivity

parallels999 avatar Mar 08 '23 14:03 parallels999