NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Requests for Laravel

Workflow presets

Reuse rule, quorum and stage wiring from config('approvals.workflows'):

// config/approvals.php
'workflows' => [
    'payout' => ['rule' => 'quorum', 'quorum' => 2, 'required_approvers' => 3],
    'release' => ['stages' => [
        ['rule' => 'unanimous', 'required_approvers' => 2, 'name' => 'engineering'],
        ['rule' => 'any', 'required_approvers' => 1, 'name' => 'product'],
    ]],
],

Then open a request against a preset by name:

// Flat preset — supply the approvers:
Requests::make()->workflow('payout')->requireApprovalsFrom([$a, $b, $c])->create();

// Staged preset — one approver group per stage:
Requests::make()->workflow('release')->stageApprovers([[$eng1, $eng2], [$product]])->create();
  • Flat presets take the approver models passed to requireApprovalsFrom(); a bare id is refused with InvalidApprover.
  • Staged presets take one approver group per stage through stageApprovers().
  • A workflow takes precedence over stages() and the flat approver list.
  • For staged presets the preset’s reject_on_stage_rejection applies, not the builder’s rejectOnStageRejection().
  • An unknown or malformed preset throws the engine’s UnknownWorkflowException.

Preset keys

KeyApplies toMeaning
ruleflat preset, each stageunanimous, quorum, any or weighted (default unanimous).
quorumflat preset, each stageInteger threshold for quorum / weighted.
required_approversflat preset, each stageHow many approvers the rule counts; mandatory and positive for every stage.
nameeach stageStage name, read back through currentStage()->name.
stagesstaged presetNon-empty list of stage arrays — its presence makes the preset staged.
reject_on_stage_rejectionstaged presetWhether a rejected stage rejects the whole request (default true).
expiryany presetSeconds until the engine’s approval request lapses — separate from the request’s own expires_at.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.