›
byrcsc/laravel-checklist · 1.x
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;| Signature | Result |
|---|---|
make(string $name): self | Start an in-memory template definition. |
passThreshold(?float $percent): self | Set the pass percentage or clear it with null. |
section(string $name, Closure $callback, ?string $key = null): self | Open a nested section during the callback. |
publish(): TemplateVersion | Persist, validate, and publish version 1 transactionally. |
make() does not write to the database. publish() is the only builder write
boundary.
| Signature | Stored configuration |
|---|---|
checkbox(string $label): self | none |
yesNo(string $label): self | none |
passFail(string $label): self | none |
text(string $label, ?int $maxLength = null): self | max_length when provided |
number(string $label, int|float|null $min = null, int|float|null $max = null): self | non-null min and max |
rating(string $label, int $min, int $max): self | required min and max |
date(string $label): self | none |
select(string $label, array $options, bool $multiple = false): self | options 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.
| Signature | Default when called without an argument |
|---|---|
critical(bool $critical = true): self | mark critical |
required(bool $required = true): self | mark required |
weight(float $weight): self | no default argument |
key(string $key): self | no 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.
requireEvidenceWhen(
mixed $value,
EvidenceType|string $type = EvidenceType::Photo,
RuleOperator $operator = RuleOperator::Equals,
): self
requireNoteWhen(
mixed $value,
RuleOperator $operator = RuleOperator::Equals,
): selfEvidence type strings are photo, file, and signature. An unknown string
throws during authoring.
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.
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.