How to remove an attibute from the field properties BEFORE the data is converted to JSON #1388
Unanswered
intellisoftwaremx
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a table let's call it file_data with a blob field among others. I've implemented ActivityLog in the model using this function:
I want to log any change in any field including the blob. The problem comes when ActivityLog tries to write in the log table because when it attempts to add the blob in the properties field and that causes this error (I understand that this happens because of the blob data):
Unable to encode attribute [properties] for model [Spatie\Activitylog\Models\Activity] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded.
I tried to change the blob data with just the size of it from the properties field using a tapActivity function,
but it seems that the error is fired before that tapActivity function is called.
I changed my getActivitylogOptions function to include logExcept(["blob_field"]) like this:
and the error disappeared but also if a change happens in the blob field the activitylog is not trigger.
The question is: How can I remove the blob data from the properties to:
Any Ideas?
Beta Was this translation helpful? Give feedback.
All reactions