Skip to main content
ModelScribe ships two Artisan commands: model-scribe:prune for enforcing your retention policy and removing stale audit records, and model-scribe:make-table for scaffolding the database migrations needed when you add a new named log store. Both commands are registered automatically by the package’s service provider — no additional setup is required.

model-scribe:prune

Deletes stale audit log entries from every table managed by the target driver, according to the retention policy set in config/model-scribe.php. Signature
Description: Prune stale ModelScribe audit log entries according to retention policy.

Options

Examples

Output

The command always exits successfully and prints the total number of records removed:
If the driver’s retention type is permanent, or if the driver does not manage persistent storage (e.g. file), the count will be 0.
For a full explanation of how each driver handles pruning and how to schedule this command, see the Pruning guide.

model-scribe:make-table

Generates a Laravel database migration for an additional ModelScribe log table. Use this whenever you want to route a model’s audit entries to its own dedicated table via a named store. Signature
Description: Create a migration for an additional ModelScribe log table (store).

Arguments

Options

Examples

After the migration file is written, the command also prints a reminder showing the exact configuration snippet you need to add:
The generated migration uses the same schema as the default model_scribe_logs table — including all optimised indices on subject_type, subject_id, causer_type, causer_id, log_name, event, and created_at. You get identical query performance on every named store without any extra configuration.

Follow-up steps

After running the command, complete the setup in three steps:
1

Run the migration

Create the new table in your database:
2

Register the store in config

Open config/model-scribe.php and add the new store under drivers.database.stores:
3

Set $auditLogName on your model

Point the model at the new store by setting $auditLogName to match the store key:
All future audit entries for Invoice will now be written to — and pruned from — invoices_scribe_logs instead of the default table.
For the full guide on routing models to named stores, including multi-table stores, guard-based routing, and cross-database configurations, see the Multi-table routing reference.