Overview

Exowpee automatically tracks changes to important models through an activity logging system. Every create, update, and delete operation on tracked models is recorded with who made the change, what changed, and when.

How it works

AuditableTrait

File: packages/shared/src/Traits/AuditableTrait.php Add this trait to any model to automatically log its changes. AuditableTrait wraps Spatie’s LogsActivity trait internally and also provides a custom AuditableBuilder:
The trait hooks into Eloquent’s model events via Spatie Activity Log:

ActivityLog model

File: packages/shared/src/Models/ActivityLog.php The shared_activity_log table stores all tracked changes:
Unlike most tables in Exowpee, shared_activity_log uses bigIncrements (auto-incrementing integer) as its primary key, not KSUID.

Querying activity logs

Via API

The ActivityLogController (packages/shared/src/Http/Controllers/ActivityLogController.php) exposes three endpoints:

records — Activity for a specific model instance

Requires permission: read_record_activity Returns all activity log entries for the given subject, ordered by created_at descending.

actions — Activity caused by a specific user profile

Requires permission: read_user_activity Returns activity entries grouped by batch_uuid, showing one entry per batch.

getForBatch — All activity entries in a batch

Returns all entries sharing the same batch_uuid, grouped by subject_type and subject_id. If there is only one entry, it is returned directly.

Via code

What’s logged

The properties column stores a JSON object with the changes:
For created events, only attributes is present. For deleted events, only old is present.