Skip to main content

PlatformAuditLog Model

The PlatformAuditLog model records all cross-tenant actions performed by platform managers.

Table: platform_audit_logs
Model: App\Models\PlatformAuditLog

Database Schema

ColumnTypeNullableDescription
idbigint unsignedNoPrimary key
platform_manager_user_idbigint unsignedNoActing user
target_organization_idbigint unsignedNoTarget organization
actionstringNocreate, update, delete, view
target_entity_typestringNoModel affected
target_entity_idintNoRecord ID
before_stateJSONYesValues before change
after_stateJSONYesValues after change
reasonstringYesReason for action
ip_addressstringYesRequest IP
user_agentstringYesRequest user agent
created_atdatetimeNo
updated_atdatetimeNo

Relationships

$log->platformManager() → User
$log->targetOrganization() → Organization

Usage Notes

  • Platform audit logs are not tenant-scoped.
  • They are used for compliance, debugging, and security auditing.
  • before_state and after_state store snapshots of the affected record.