Skip to content

API Reference

Components

ComponentNamespaceDescription
StateSelectRoBYCoNTe\FilamentFlow\Forms\ComponentsDropdown select for states
StateRadioRoBYCoNTe\FilamentFlow\Forms\ComponentsRadio button group for states
StateToggleButtonsRoBYCoNTe\FilamentFlow\Forms\ComponentsToggle button group for states
StateSelectColumnRoBYCoNTe\FilamentFlow\Tables\ColumnsInteractive table column (with sorting)
StateColumnRoBYCoNTe\FilamentFlow\Tables\ColumnsDisplay-only table column (with sorting)
StateExportColumnRoBYCoNTe\FilamentFlow\Tables\ColumnsExport column with state label formatting
StateSelectFilterRoBYCoNTe\FilamentFlow\Tables\FiltersTable filter for states
StateGroupRoBYCoNTe\FilamentFlow\Tables\GroupingGroup table records by state

Actions

ActionNamespaceDescription
StateActionRoBYCoNTe\FilamentFlow\ActionsSingle record state transition
StateActionGroupRoBYCoNTe\FilamentFlow\ActionsAuto-generated action group
StateBulkActionRoBYCoNTe\FilamentFlow\ActionsBulk state transition

Utilities

UtilityNamespaceDescription
StateTabsRoBYCoNTe\FilamentFlowGenerate tabs for listing pages

Interfaces

InterfaceMethodsDescription
HasLabelgetLabel(): stringDisplay name for the state
HasIcongetIcon(): stringIcon for the state
HasColorgetColor(): string|arrayColor for the state
HasDescriptiongetDescription(): stringDescription text for the state
HasStateMetadataCombines all metadata interfacesFull state metadata contract
HasStateSortOrdergetSortOrder(): intCustom sort position for state
HasAccessRulesgetCreateAccessRules(), getViewAccessRules(), getEditAccessRules(), getTransitionAccessRules()Code-First state access rules
RoleResolvergetRoles(), hasAnyRole(), isSuperAdmin()Role resolution for access control
PermissionResolverhasPermission()Permission resolution for access control
HasStateNotificationsonEnterNotifications(), onExitNotifications()Notifications on state enter/exit
HasTransitionNotificationsnotifications()Notifications on transition

Traits

TraitNamespaceDescription
HasStateMetadataRoBYCoNTe\FilamentFlow\ConcernsProvides metadata methods for states
HasStateSortOrderRoBYCoNTe\FilamentFlow\ConcernsProvides sort order mapping for states
HasStateSortingRoBYCoNTe\FilamentFlow\ConcernsEnables custom sorting in table columns
HasStateOptionsRoBYCoNTe\FilamentFlow\ConcernsProvides state options for form/table fields
HasDatabaseTransitionsRoBYCoNTe\FilamentFlow\ConcernsEnables database-configured transitions
HasFlexibleStatesRoBYCoNTe\FilamentFlow\ConcernsSupports both PHP and database-only states
HasStateAccessRoBYCoNTe\FilamentFlow\ConcernsEnables state-based access control for models
HasStateActionsRoBYCoNTe\FilamentFlow\ConcernsCommon functionality for state actions
HasStateAttributesRoBYCoNTe\FilamentFlow\ConcernsManages state attribute mapping
HasTransitionFormRoBYCoNTe\FilamentFlow\ConcernsHandles transition form generation and validation
HasWorkflowCreationRoBYCoNTe\FilamentFlow\ConcernsDatabase workflow creation helpers
HasWorkflowAssignmentsRoBYCoNTe\FilamentFlow\ConcernsWorkflow assignment management
HasWorkflowFormRoBYCoNTe\FilamentFlow\ConcernsForm building for workflow configuration
ResolvesActionAttributesRoBYCoNTe\FilamentFlow\ConcernsResolves state attributes for actions

Models (Database-Driven Workflows)

ModelNamespaceDescription
WorkflowRoBYCoNTe\FilamentFlow\ModelsWorkflow definitions
WorkflowStateRoBYCoNTe\FilamentFlow\ModelsState definitions (PHP or database-only)
WorkflowTransitionRoBYCoNTe\FilamentFlow\ModelsTransition configurations
WorkflowTransitionFieldRoBYCoNTe\FilamentFlow\ModelsFields to show in transition forms
WorkflowStateFieldRoBYCoNTe\FilamentFlow\ModelsField permissions per state
WorkflowFieldPermissionRoBYCoNTe\FilamentFlow\ModelsField-level permissions
WorkflowAssignmentRoBYCoNTe\FilamentFlow\ModelsUser/team assignments to workflows
WorkflowNotificationRoBYCoNTe\FilamentFlow\ModelsNotification configurations
WorkflowNotificationRecipientRoBYCoNTe\FilamentFlow\ModelsNotification recipient strategies
WorkflowNotificationChannelRoBYCoNTe\FilamentFlow\ModelsNotification delivery channels
WorkflowNotificationTemplateRoBYCoNTe\FilamentFlow\ModelsNotification message templates
WorkflowNotificationLogRoBYCoNTe\FilamentFlow\ModelsNotification delivery audit logs
WorkflowUserInvolvementRoBYCoNTe\FilamentFlow\ModelsUser involvement tracking
WorkflowTransitionSnapshotRoBYCoNTe\FilamentFlow\ModelsAudit trail for transitions
WorkflowTransitionMetadataRoBYCoNTe\FilamentFlow\ModelsAdditional metadata for transitions
WorkflowStateAccessRuleRoBYCoNTe\FilamentFlow\ModelsState-based access control rules

Services

ServiceNamespaceDescription
StateServiceRoBYCoNTe\FilamentFlow\ServicesManages state metadata and options
TransitionFormServiceRoBYCoNTe\FilamentFlow\ServicesBuilds and validates transition forms
WorkflowCreationServiceRoBYCoNTe\FilamentFlow\ServicesCreates workflows from configuration
WorkflowFieldPermissionsServiceRoBYCoNTe\FilamentFlow\ServicesManages field permissions
WorkflowStateAccessServiceRoBYCoNTe\FilamentFlow\ServicesState-based access control evaluation
NotificationServiceRoBYCoNTe\FilamentFlow\ServicesOrchestrates workflow notifications
RecipientResolverRoBYCoNTe\FilamentFlow\ServicesResolves notification recipients
FormBuilderHelperRoBYCoNTe\FilamentFlow\ServicesAdvanced form building utilities

Casts

CastNamespaceDescription
FlexibleStateCastRoBYCoNTe\FilamentFlow\CastsCustom cast for PHP + database-only states

Support Classes

ClassNamespaceDescription
DefaultRoleResolverRoBYCoNTe\FilamentFlow\SupportDefault role resolver (supports Spatie Permission)
DefaultPermissionResolverRoBYCoNTe\FilamentFlow\SupportDefault permission resolver (supports Gates)
AccessRuleEvaluatorRoBYCoNTe\FilamentFlow\SupportEvaluates access rule tokens against users/records

Exceptions

All exceptions live in the RoBYCoNTe\FilamentFlow\Exceptions namespace.

ExceptionWhen ThrownNotable Properties / Methods
UnauthorizedTransitionExceptionUser not allowed to transition to a stategetRecord(), getFromState(), getToState(), getUser()
WorkflowNotFoundExceptionNo active workflow found for the model class$modelClass property
ActionNotFoundExceptionRequested action does not exist for the current state$actionName property
ConditionNotMetExceptionA transition condition evaluated to false$actionName property
InitialStateNotFoundExceptionWorkflow exists but has no state marked as initial
AuthenticationRequiredExceptionAn operation requires an authenticated user but none is present
StateDeletionExceptionCannot delete a state because transitions reference it
InvalidStateExceptionThe state field value is not a valid State instance
InvalidComponentExceptionA Filament form component does not support readonly/disabled$fieldName property

UnauthorizedTransitionException exposes:

  • getMessage() — Human-readable error message
  • getRecord() — The model record involved
  • getFromState() — The source state class/name
  • getToState() — The target state class/name
  • getUser() — The user who attempted the transition (null if unauthenticated)

Builders

BuilderNamespaceDescription
WorkflowNotificationBuilderRoBYCoNTe\FilamentFlow\BuildersFluent builder for code-first notifications

WorkflowNotificationBuilder Methods:

php
WorkflowNotificationBuilder::make()
    ->name('notification_name')           // Optional name for logging
    ->channel('database', $config)        // Channel: database, mail
    ->recipients(['@owner', 'role:admin']) // Who receives the notification
    ->title('Title with {{variables}}')    // Notification title
    ->body('Body with {{variables}}')      // Notification body
    ->subject('Email subject')             // Email subject (mail channel)
    ->actionUrl('/url', 'Button Text')     // Action button
    ->priority('high')                     // low, medium, high, urgent
    ->templateEngine('plain')              // plain, blade, mustache
    ->immediate()                          // Send immediately (default)
    ->delay(30)                            // Delay by minutes
    ->metadata(['key' => 'value']);        // Additional metadata

Advanced Features

Custom State Sorting

Define custom sort order for states in tables to match your workflow logic:

php
// In your state classes
class PendingState extends OrderState implements HasStateSortOrder
{
    public static function getSortOrder(): int
    {
        return 1; // First in the list
    }
}

class ProcessingState extends OrderState implements HasStateSortOrder
{
    public static function getSortOrder(): int
    {
        return 2; // Second in the list
    }
}

Then use sortable columns:

php
StateSelectColumn::make('state')
    ->sortable() // Uses custom sort order automatically

Workflow Model Scopes

RoBYCoNTe\FilamentFlow\Models\Workflow

Static Finder

php
use RoBYCoNTe\FilamentFlow\Models\Workflow;

// Find the active workflow for a model class (tenant fallback applied automatically)
Workflow::findForModel(Order::class, 'state');

// Find for a specific tenant ID (overrides auto-detection)
Workflow::findForModel(Order::class, 'state', $tenantId);

findForModel checks for a tenant-specific workflow first, then falls back to a global workflow (tenant_id = null). Results are cached using the configured cache store and TTL.

Query Scopes

php
// Include both global and current-tenant workflows
Workflow::query()->forCurrentTenant()->get();

// Only workflows for a specific tenant
Workflow::query()->forTenant($tenantId)->get();

// Only global workflows (tenant_id = null)
Workflow::query()->global()->get();

Instance Methods

php
$workflow->initialState();    // ?WorkflowState — the state marked is_initial = true
$workflow->finalStates();     // HasMany<WorkflowState> — states marked is_final = true
$workflow->isGlobal();        // bool — true when tenant_id is null
$workflow->isTenantSpecific(); // bool — true when tenant_id is set

// Flush all workflow caches (affects entire cache store — use with care)
Workflow::flushCache();

Proprietary software. All rights reserved.