Replies: 1 comment
-
\App\Models\MyAuditableModel::translateProperty($field) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I recently embarked on a mission to enhance the readability of audit logs generated by our beloved Laravel Auditing package. The objective was to transform the cryptic property names in the
new_values
andold_values
JSON columns into human-readable titles, making the audit logs more accessible and easier to understand.With the assistance of ChatGPT, I crafted a solution that not only improves the log readability but also enriches the overall user experience when dealing with audit data. The process began with extracting all unique property names directly from the audit logs, which involved querying the
audits
table and dynamically listing all column names involved in thenew_values
andold_values
, excluding common Laravel timestamps and IDs.Here's a snippet of how the unique property names were extracted:
After identifying the unique properties, I manually mapped them to more descriptive titles. ChatGPT was instrumental in generating a comprehensive dictionary that translates technical column names into user-friendly terms. Here’s a glimpse of the translation array and how it's utilized:
And in the Blade template, making the audit data presentation more intuitive:
This enhancement significantly improved the audit log readability and overall user experience. I am excited to share this idea with the community and hear your thoughts. Perhaps it could inspire further enhancements or even be integrated into the package.
Result:
Beta Was this translation helpful? Give feedback.
All reactions