Feature: Callback to map values #8
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
php
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pxlrbt/filament-activity-log#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Callback to map values
formatState()or similar for display.I was searching exactly for this feature, here's a proposal on how it could work and remain consistent with the LogsActivity trait in spatie/laravel-activitylog:
the use case is that you don't want to actually change the properties in the database while logging, just the way they are shown on the screen (for example to fetch relationship names, format dates, a meaningful display of structured data).
Suggesting to use tapActivity in the model instead would mess up this package "Restore" feature, because it is used to actually replace the changed data. For things like dates and times it may be OK but for structured data or relationship names it wouldn't work anymore.
The feature is implemented in the spatie package like this
if (method_exists($model, 'tapActivity')) {$logger->tap([$model, 'tapActivity'], $eventName);}and could become something likeif (method_exists($this, 'tapActivity')) {$logger->tap([$model, 'tapActivity'], $eventName);}somewhere in ListActivities.php.What's your stance on this?