You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
<?php
namespace App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource;
use pxlrbt\FilamentActivityLog\Pages\ListActivities;
class ListUserActivities extends ListActivities
{
protected static string $resource = UserResource::class;
public function tapActivity(Activity $activity, string $eventName): void {}
}
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 like if (method_exists($this, 'tapActivity')) {$logger->tap([$model, 'tapActivity'], $eventName);} somewhere in ListActivities.php.
Callback to map values
formatState()
or similar for display.The text was updated successfully, but these errors were encountered: