Skip to content

Checklist

Records can have a checklist on their detail page: items with a text that are ticked off. Who ticked an item and when is shown next to it.

final class OrderResource extends Resource
{
protected bool $checklist = true;
// Optional: templates users can insert.
public function checklist(Checklist $checklist): Checklist
{
return $checklist->templates([
'Onboarding' => ['Order the notebook', 'Create the account', 'Hand over the key'],
]);
}
}

The checklist appears after the workflow and the ownership, before your own detailComponents() and the comments.

  • An item is a text of up to 500 characters, nothing else: no one responsible, no due date. Work with someone responsible and a date belongs into tasks or records of its own (e.g. work packages).
  • Tick and untick: who and when are set by the server, never by the browser, and shown below the item.
  • Add, change, delete, move up and down. Items keep their order, numbered without gaps.
  • At most 200 items per record.

templates() takes named lists of items, or a closure that returns them for a record:

->templates(fn (array $order): array => $order['kind'] === 'hire'
? ['Onboarding' => [...]]
: ['Offboarding' => [...]])

Insert from template adds the items at the end. Afterwards they are items like any other; changing a template does not change checklists.

Users who may see the record see its checklist. Users who may update the record – permission <slug>.update, policies, workflow states that lock the record – change it. No permission of its own is needed. Every change is written to the audit log.

ProgressColumn::make('checklist')->label('Checklist')->checklist(),

Shows 3/5 with a bar, green when all items are done, counted for a page in one query; records without items stay empty. See ProgressColumn.

Items are stored in anvil_checklist_items with the table of the model and the internal id of the record. Deleting a record deletes its checklist; soft deleted records keep it. service('checklists') reads and writes items from own code; it does not check permissions.