Field Manual PHP / Laravel reference
← Financial-system patterns

Audit trails

Financial audit records should explain state changes with actor and correlation data.

What it is

Financial audit records should explain state changes with actor and correlation data.

When to use it

Write the audit alongside the successful local operation.

Syntax

actor_id + action + subject_id + timestamp + correlation_id

Example

DB::table("audit_logs")->insert([
    "actor_id" => $actor->id, "action" => "transfer.settled",
    "subject_id" => $transfer->id, "correlation_id" => $requestId,
    "created_at" => now(),
]);

Common mistakes

A writable SQLite file is not tamper-proof; access controls and retention are organizational decisions.

Related topics

Audit trails