Disable or remove the standard UserResolver from being tracked to the audits #837
-
Actually it's more of a question than a bug. What I want is starting by the standard configuration of Laravel Auditing to exclude the user (id and user_type) from the database and only save the email of a user. My attempt was to comment the entire User morph stuff:
and add my own resolver Actual BehaviourThe user_id column is still present in the INSERT INTO audits query. Expected BehaviourOnly add insert columns to the query that are listed under the resolvers. Steps to ReproduceAll that is needed is to comment the entiry user array from the audit.php, as mentioned above. Possible SolutionsI guess, I need to do more to prevent that from happening and I hope, Laravel Auditing is flexible enough to exlude the User stuff completely. Just commenting out the user array won't stop Laravel Auditing from trying to add user information. However, another possible solution might be to alter the UserResolver to get that behaviour. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Try using laravel-auditing/src/Auditable.php Lines 346 to 349 in 7d09546 public function transformAudit(array $data): array
{
unset($data['user_id']);
unset($data['user_model']);
return $data;
} Still, you might need more changes for other features. |
Beta Was this translation helpful? Give feedback.
Try using
transformAudit
to removeuser_id
, anduser_model
from insert data arraylaravel-auditing/src/Auditable.php
Lines 346 to 349 in 7d09546
Still, you might need more changes for other features.