Skip to main content

Logbook

Every resource detail page adds a logbook item to the actions dropdown.

The logbook opens a modal with an EloquentTableNode backed by Qore\Next\System\Models\Log:

Log::query()->whereMorphedTo('entity', $model)

Automatic Logs

Qore writes logs for common resource flows:

  • resource create, update and delete mutations;
  • field mutation changes;
  • file attachments and removals;
  • relation attach and detach changes;
  • resource action execution.

Field mutation logging compares the original model value with the new model value and skips the log when nothing changed.

Manual Logs

Use qore()->logger() when application-specific workflows need to appear in the logbook:

qore()->logger()
->setEntity($product)
->setDescription('price_imported')
->setFieldName('price')
->setOldValue($oldPrice)
->setNewValue($newPrice)
->setPayload(['source' => 'import'])
->save();

The logger service sets the authenticated user ID automatically when a user is logged in.

Log Shape

The default logbook table shows:

  • ID;
  • date;
  • user;
  • description;
  • field;
  • new value;
  • old value.

payload is available on the model for structured context, but it is not shown as a normal table column by default.

Descriptions

Use short, stable descriptions such as price_imported, approved or the values from ResourceMutationDescription.

Avoid putting long human text in description; put detailed context in payload so the log stays filterable and consistent.