All projects

git show fb37e6e 1 / 18

Filament Workflows

A Filament plugin that runs predefined actions when a model is created or updated.

branch
open-source
type
Open source,Laravel & Filament
stack
PHP,Laravel,Filament
stars
★ 19
packagist
1,386 installs as of 28.10.2026
ci
run-tests.yml,fix-php-code-styling.yml,phpstan.yml
license
MIT
commit
fb37e6e
README.md

Workflows in Laravel

Filament Workflows connects events in a Laravel application to executable actions. Workflows and their triggers are configured in the Filament panel. When the conditions match, the plugin runs the associated actions.

Custom actions

Models connect to the plugin through a trait. Actions are PHP classes with a handle method that defines what happens after a matching event.

Workflows are configured in the admin panel; application logic stays in the action classes.

Installation

bash
composer require tschucki/filament-workflows

Next, install the plugin and register it in the Filament panel. The repository documentation contains the full setup and an example action.

Technical structure

Explore each part directly in the repository.

  1. fb37e6eModelObserver.php

    Model event

    An observer receives events such as created or updated and finds the associated workflows.

    View source code
    Show codeHide code
    src/Observers/ModelObserver.php fb37e6e
    private function processWorkflows(Model $model, string $event): void
    {
        if (! method_exists($model, 'getWorkflows')) {
            return;
        }
    
        $workflows = $model->getWorkflows();
    
        $workflows
            ->filter(fn (Workflow $workflow) => $workflow->trigger[0]['event'] === $event)
            ->each(function (Workflow $workflow) use ($model) {
                if ($workflow->shouldTrigger($model)) {
                    $workflow->runActions($model);
                }
            });
    }
    Lines 10 to 25 of 51, full file on GitHub
  2. fb37e6eWorkflow.php

    Conditions

    A field, operator and comparison value define the trigger. All conditions must match.

    View source code
    Show codeHide code
    src/Models/Workflow.php fb37e6e
    $field = $trigger['field'];
    $operator = $trigger['operator'];
    $value = $trigger['value'];
    
    $modelValue = $model->{$field};
    
    return match ($operator) {
        '==' => $modelValue == $value,
        '===' => $modelValue === $value,
        '!=' => $modelValue != $value,
        '!==' => $modelValue !== $value,
        '>' => $modelValue > $value,
        '<' => $modelValue < $value,
        '>=' => $modelValue >= $value,
        '<=' => $modelValue <= $value,
        default => false,
    };
    Lines 24 to 40 of 56, full file on GitHub
  3. fb37e6eBaseAction.php

    Queued actions

    The selected PHP actions receive the model. BaseAction uses Laravel's queue interface.

    View source code
    Show codeHide code
    src/WorkflowActions/BaseAction.php fb37e6e
    class BaseAction implements ShouldQueue
    {
        use Dispatchable;
        use InteractsWithQueue;
        use Queueable;
        use SerializesModels;
    
        public function handle(): void
        {
            //
        }
    Lines 11 to 21 of 42, full file on GitHub
Next project React Native Sanctum open-source Open source,React Native