›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-checklist
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Templates and versions
  • Items and sections
  • Checklist lifecycle
  • Answers and evidence
  • Conditional rules
  • Scoring
  • Recurring schedules
  • Audit history

Operations

  • Author a template
  • Run a checklist
  • Create a schedule
  • Customize notifications
  • Export and report
  • Verify audit history
  • Composing with sibling packages

Reference

  • Configuration
  • Builder API
  • Models and scopes
  • Events and notifications
  • Console commands
  • Enums and contracts
  • Testing
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Templates and versions
  • Items and sections
  • Checklist lifecycle
  • Answers and evidence
  • Conditional rules
  • Scoring
  • Recurring schedules
  • Audit history

Operations

  • Author a template
  • Run a checklist
  • Create a schedule
  • Customize notifications
  • Export and report
  • Verify audit history
  • Composing with sibling packages

Reference

  • Configuration
  • Builder API
  • Models and scopes
  • Events and notifications
  • Console commands
  • Enums and contracts
  • Testing
  • Troubleshooting

byrcsc/laravel-checklist · 1.x

Builder API.

Reference every fluent template authoring method, parameter, default, and return type.

TemplateBuilder defines and publishes a complete first template version in one expression. Every fluent method returns the same builder unless this page says otherwise.

use ByRcsc\LaravelChecklist\Authoring\TemplateBuilder;

Template methods

SignatureResult
make(string $name): selfStart an in-memory template definition.
passThreshold(?float $percent): selfSet the pass percentage or clear it with null.
section(string $name, Closure $callback, ?string $key = null): selfOpen a nested section during the callback.
publish(): TemplateVersionPersist, validate, and publish version 1 transactionally.

make() does not write to the database. publish() is the only builder write boundary.

Item methods

SignatureStored configuration
checkbox(string $label): selfnone
yesNo(string $label): selfnone
passFail(string $label): selfnone
text(string $label, ?int $maxLength = null): selfmax_length when provided
number(string $label, int|float|null $min = null, int|float|null $max = null): selfnon-null min and max
rating(string $label, int $min, int $max): selfrequired min and max
date(string $label): selfnone
select(string $label, array $options, bool $multiple = false): selfoptions and multiple

Each select option accepts value, optional label, and optional score from 0 to 1. Values must be unique strings or integers. The options list cannot be empty.

Item modifiers

SignatureDefault when called without an argument
critical(bool $critical = true): selfmark critical
required(bool $required = true): selfmark required
weight(float $weight): selfno default argument
key(string $key): selfno default argument

Modifiers change the item declared immediately before them in the current section. Calling one without an item in scope throws TemplateValidationException.

Weights must be greater than zero when the version is validated. Keys must be unique across both items and sections in one version.

Requirement rules

requireEvidenceWhen(
    mixed $value,
    EvidenceType|string $type = EvidenceType::Photo,
    RuleOperator $operator = RuleOperator::Equals,
): self

requireNoteWhen(
    mixed $value,
    RuleOperator $operator = RuleOperator::Equals,
): self

Evidence type strings are photo, file, and signature. An unknown string throws during authoring.

Visibility rules

showWhen(
    mixed $value,
    string $target,
    RuleOperator $operator = RuleOperator::Equals,
): self

hideWhen(
    mixed $value,
    string $target,
    RuleOperator $operator = RuleOperator::Equals,
): self

$target is the key of an item or section. Targets are resolved when the builder persists the version, so declaration order does not matter.

Exceptions

Builder and publication errors extend ChecklistException. Invalid structure, configuration, rule graphs, keys, and modifier placement throw TemplateValidationException.

Publishing an already published version or modifying frozen structure throws PublishedVersionException.

What to read next

  • Author a template for task-focused examples.
  • Items and sections for accepted answers and scoring.
  • Enums and contracts for operator and evidence enum values.
PreviousConfigurationNextModels and scopes
View source

On this page

  1. Template methods
  2. Item methods
  3. Item modifiers
  4. Requirement rules
  5. Visibility rules
  6. Exceptions
  7. What to read next