Refund Approval
Refund dispute resolution with amount branching, hooks, and host Filament resource action patterns.
Model: RefundDispute · Workflow key: refund_dispute_approval
Risk review runs when refund_amount is at least 500.
Real-world examples
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.
Try it live
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.
Documented in the 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 dispute resolution with amount branching, hooks, and host Filament resource action patterns.
Model: RefundDispute · Workflow key: refund_dispute_approval
Risk review runs when refund_amount is at least 500.
Procurement approval with amount escalation and host status mapping through WorkflowHooks.
Model: ProcurementRequest · Workflow key: procurement_request_approval
Finance review runs when amount is at least 10000.
Illustrative patterns
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).
Two-step approval for employee expense claims with optional delegation.
Gate new suppliers behind compliance review before activation.
Route large orders through extra approval nodes using transition conditions.
Require sign-off before stock corrections affect live counts.
Filament integration
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
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
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.
Start with the refund approval walkthrough or the getting-started guide.