Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions app/Http/Controllers/Dashboard/ActivityLogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
use Spatie\Activitylog\Models\Activity;

class ActivityLogController extends Controller
{
Expand Down Expand Up @@ -160,7 +161,7 @@ public function show(int $id): Response
'causer_name' => $activity->causer?->name ?? $activity->causer?->email ?? null,
'event' => $activity->event,
'batch_uuid' => $activity->batch_uuid ?? null,
'properties' => $activity->properties?->toArray() ?? [],
'properties' => $this->activityPropertiesPayload($activity),
'created_at' => $activity->created_at->toIso8601String(),
'updated_at' => $activity->updated_at->toIso8601String(),
],
Expand All @@ -180,7 +181,21 @@ public function properties(int $id): JsonResponse
}

return response()->json([
'properties' => $activity->properties?->toArray() ?? [],
'properties' => $this->activityPropertiesPayload($activity),
]);
}

/**
* Custom data from {@see Activity::$properties} plus Spatie v5 model diffs in {@see Activity::$attribute_changes}.
* Legacy rows may still store attributes/old only under `properties`.
*
* @return array<string, mixed>
*/
private function activityPropertiesPayload(Activity $activity): array
{
$custom = $activity->properties?->toArray() ?? [];
$attributeChanges = $activity->attribute_changes?->toArray() ?? [];

return array_merge($custom, $attributeChanges);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/build/assets/DeveloperCardSection-ByWs1UIH.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/build/assets/DeveloperCardSection-DoXJvTN0.js

This file was deleted.

Loading
Loading