Skip to content

Facade ​

Rembon\LaravelAuditor\Facades\Auditor

Inside a request, job or command ​

MethodDescription
withProperty(string $key, mixed $value)Add a (redacted) property to the current entry.
withProperties(array $properties)Add several properties.
tag(string ...$tags)Tag the current entry (filterable in the dashboard).
ignore()Drop the current entry. Model changes are still kept.
withoutAuditing(callable $callback)Nothing inside the callback is recorded.
correlationId(): stringThe current correlation ID.

Configuration (in a service provider) ​

MethodDescription
auth(Closure $callback)Who may open the dashboard; overrides the viewAuditor gate.
resolveUserUsing(Closure $callback)Resolve the causing user yourself.
filter(Closure $callback)Return false to drop an EntryData before it is stored.
redactUsing(Closure $callback)fn (string $key, mixed $value): bool — extra redaction rule.
extend(string $driver, Closure $callback)Register a storage driver.
displayUserUsing(Closure $callback)Name/avatar shown for users in the dashboard.
useNonce(string|Closure $nonce)CSP nonce for the dashboard's tags.
guard(callable $callback, mixed $default = null)Run code the way the package does: report failures instead of throwing.

Testing ​

fake() and the assertions listed in Testing.

Models ​

ModelUseful API
Models\Entryscopes causedBy($user), since($date), forCorrelation($id), withDeniedAbilities(), ofType(EntryType::Job); relation modelChanges()
Models\ModelChangescopes causedBy, since, forCorrelation, forModel($type, $id); relations entry(), auditable(), user(); changedAttributes()
Traits\Auditablerelation audits()

Released under the MIT License.