After runningDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HypathStack/model-scribe/llms.txt
Use this file to discover all available pages before exploring further.
php artisan vendor:publish --tag="model-scribe-config", the file config/model-scribe.php becomes the single source of truth for all ModelScribe behaviour. Every option — from which driver persists your audit records to how long they are kept — is controlled here. The sections below walk through each top-level key and every nested driver block in detail.
Default configuration file
Top-level keys
The name of the driver that ModelScribe uses unless a model overrides it with
$auditDriver. Must match a key inside drivers.Reads from the environment variable MODEL_SCRIBE_DRIVER. Defaults to
'database'.Supported built-in values: "database", "file", "stack".A map of driver name → driver configuration block. Each entry must contain at
least a
driver key that identifies the driver type. See the Driver blocks
section below for the full schema of each built-in driver.When
true, ModelScribe automatically attaches the current HTTP request URL,
client IP address, and User-Agent string to every log entry. Disable this if
you are logging from CLI contexts only or want a leaner storage footprint.Defaults to true.The Laravel authentication guard used to resolve the currently authenticated
user (the “causer”). When
null, ModelScribe calls Auth::user() using
whatever guard is active at the time of the event.Set this to a specific guard name (e.g. 'web', 'api') when your
application uses multiple guards and you always want a particular one to be
the source of the causer.Defaults to null.Maps a guard name to a named store. When a model’s See Multi-Table Routing for the full
guard-routing workflow.
$auditLogName is
'default', ModelScribe checks the currently active guard against this map
and rewrites the log name before routing to the database driver.Driver blocks
database
Thedatabase driver persists audit entries to one or more database tables via
Eloquent. It is the default driver and supports named stores, custom connections,
and retention policies.
Must be
"database".The Laravel database connection name to use for writes and pruning. When
null, the application’s default connection is used.Reads from MODEL_SCRIBE_DB_CONNECTION. Defaults to null.The default table name for models that do not define a specific named store
via
$auditLogName.Reads from MODEL_SCRIBE_TABLE. Defaults to 'model_scribe_logs'.A map of store name → store configuration used for multi-table routing. Each
entry can contain:
tables(array) — one or more table names to write to simultaneouslyconnection(string|null) — override the DB connection for this storeauth_guard(string|null) — override the causer guard for this store
table defined
above. See Multi-Table Routing for
a detailed walkthrough.Controls how long records are kept when
model-scribe:prune runs. Contains
three sub-keys:type—'permanent','days', or'rotating'; readsMODEL_SCRIBE_RETENTIONdays— number of days to retain records whentypeis'days'; readsMODEL_SCRIBE_RETENTION_DAYS; default90keep— maximum number of records per table whentypeis'rotating'; readsMODEL_SCRIBE_RETENTION_KEEP; default500
Per-driver causer guard override. Supersedes the global
auth_guard value
for entries written through this driver. Defaults to null.file
Thefile driver writes audit entries to Laravel’s logging system as structured
info-level log messages, including the full entry context as JSON.
Must be
"file".Any channel name defined in
config/logging.php. The entry is dispatched via
Log::channel($channel)->info(...).Reads from MODEL_SCRIBE_LOG_CHANNEL. Defaults to 'daily'.Per-driver causer guard override. Defaults to
null.stack
Thestack driver fans a single log entry out to multiple other named drivers
simultaneously. It is useful when you want both a queryable database record and
a log-file trail for every event.
Must be
"stack".An ordered list of driver names (keys from the
drivers map) to forward each
entry to. Every listed driver receives the same LogEntry object.Per-driver causer guard override. Note that each downstream driver in the
stack may also define its own
auth_guard. Defaults to null.Every driver block —
database, file, stack, and any custom driver —
supports its own auth_guard key. A value set there takes precedence over the
global auth_guard setting at the top of the config file, giving you
fine-grained control over which guard resolves the causer for each storage
destination.