Real-world examples

Common workflows, without the boilerplate.

DBFlow is model-first: workflows bind to Eloquent records through HasWorkflow and the dbflowlabs/core runtime. The two walkthroughs below mirror the flows in our hosted live demo; other cards are illustrative patterns only.

Walk through the same refund and procurement flows on our hosted demo — no local install. Pick a pre-built team member, sign in, and explore approval inboxes, workflow management, and the Pro Canvas sandbox.

Demo environment for exploration only. Other ERP modules provide business context; only purchase requests and refund disputes are active workflow examples.

Open Live Demo ↗
Open live demo →

Only RefundDispute and ProcurementRequest are wired to DBFlow in the demo. Other demo modules (support tickets, vendor records, legal contracts) provide ERP context only.

Refund Approval

Refund dispute resolution with amount branching, hooks, and host Filament resource action patterns.

Model: RefundDispute · Workflow key: refund_dispute_approval

1. Support lead review 2. Amount gate 3. Risk review 4. Approved

Risk review runs when refund_amount is at least 500.

Procurement Request Approval

Procurement approval with amount escalation and host status mapping through WorkflowHooks.

Model: ProcurementRequest · Workflow key: procurement_request_approval

1. Manager review 2. Amount gate 3. Finance review 4. Approved

Finance review runs when amount is at least 10000.

Common approval shapes DBFlow supports. Full docs for these are not published yet. These are not the same as context-only modules in the live demo (for example, vendor records there are not wired to DBFlow).

Expense Claim Approval

Two-step approval for employee expense claims with optional delegation.

1. Submitted 2. Manager review 3. Finance approval 4. Reimbursed

Supplier Compliance Gate

Gate new suppliers behind compliance review before activation.

1. Application 2. Compliance check 3. Contract review 4. Active

High-value Order Approval

Route large orders through extra approval nodes using transition conditions.

1. Order placed 2. Risk check 3. Manager review 4. Fulfilled

Inventory Adjustment

Require sign-off before stock corrections affect live counts.

1. Requested 2. Warehouse review 3. Finance sign-off 4. Applied

Standard UI (dbflowlabs/filament) operates workflows in admin panels. Demo resources use lifecycle actions and timeline presenters documented here. Optional Pro Canvas sandbox previews the same two demo workflows at /admin/pro-canvas-sandbox.

How it works

Every workflow starts on your model.

Attach HasWorkflow and optional contracts such as WorkflowContextInterface for transition variables. Sync or publish a workflow definition, then call DBFlow::start() — instances, tasks, audit logs, and WorkflowHooks handle the rest.

// Trait + contracts (amount branching needs getWorkflowVariables)
use DbflowLabs\Core\Contracts\WorkflowContextInterface;
use DbflowLabs\Core\Traits\HasWorkflow;

class ProcurementRequest extends Model implements WorkflowContextInterface
{
    use HasWorkflow;

    public function getWorkflowVariables(): array
    {
        return ['amount' => (float) $this->amount];
    }
}
// Start and approve through the runtime API
use DbflowLabs\Core\DBFlow;

DBFlow::start('procurement_request_approval', $request, $user);

$task = $request->runningWorkflowInstance('procurement_request_approval')
    ?->tasks()->where('status', 'pending')->first();

DBFlow::approve($task, $manager, 'Approved.');

Shared guarantees

Every workflow gets the same safety layer.

Atomic task actions

Approve, reject, and cancel run inside database transactions via DBFlow::approve() and DBFlow::reject().

Append-only audit log

WorkflowLogger writes dbflow_workflow_logs rows for every action.

active_key guard

Duplicate active workflows for the same record are blocked with WorkflowAlreadyRunningException.

Ready to ship your first workflow?

Start with the refund approval walkthrough or the getting-started guide.