The application incorporates an Audit Logging system via Spatie Laravel Activitylog to track systemic, user, and administrative actions across the platform. This provides a transparent history for security, debugging, and compliance purposes.
- Model Tracking: Automatically logs creation, updates, and deletions on key models (e.g.,
Workspace,User,FeatureFlag). - Contextual Metadata: Captures the "causer" (the user who performed the action), the "subject" (the manipulated entity), and detailed old/new property changes.
- Admin Visibility: Super Admins can monitor the entire application’s audit trail via a dedicated, searchable interface in the Admin Panel without needing direct database access.
- Logging Trait: Models use
Spatie\Activitylog\Traits\LogsActivityand specify tracking via thegetActivitylogOptions()method orLogOptions. - Database: Uses standard
activity_logtable provided by Spatie. - Admin Controller:
App\Http\Controllers\Admin\AuditLogControllerefficiently eager loads thecauserandsubjectrelationships to serve the paginated, searchable grid. - Frontend View: Located at
resources/js/pages/admin/audit-logs.tsx, displaying intuitive diffs, raw JSON payloads, and dynamic relationship resolution.
When an entity is updated, the frontend specifically renders the properties.old and properties.attributes keys seamlessly, giving administrators a clear view of what exactly changed during that event.