Skip to content

Event Trigger

Type key: trigger
Group: Triggers
Category: trigger
Tier: CORE

The Event Trigger node starts a workflow when a Laravel event is dispatched anywhere in your application. It enables event-driven automation without coupling application code to workflow code.

Handles

HandleDirectionDescription
(none)InputTrigger nodes have no input
outputOutputPasses the event payload to the first downstream node

Configuration

FieldTypeDefaultDescription
labelstringEvent TriggerDisplay label on the canvas
eventClassstringnullThe event to listen for (see sources below)

Event Sources

There are two types of events that can be selected in eventClass:

1. Eloquent Events (from Model Integrations)

By default, your Eloquent models do not expose CRUD events to Voodflow. To make them available in the Event Trigger you need to create a Model Integration:

  1. Go to Voodflow → Model Integrations in the sidebar
  2. Click Create and select your model class (e.g. App\Models\Order)
  3. In the Eloquent Events section, tick the events you want to listen to: created, updated, deleted
  4. Configure which fields and relations should be included in the event payload
  5. Save the integration

Once saved, the enabled events immediately appear in the Event Trigger selector dropdown. The internal format is:

eloquent.created: App\Models\Order
eloquent.updated: App\Models\User
eloquent.deleted: App\Models\Product

The payload is the Eloquent model serialized via ->toArray(), filtered to the fields and relations you configured in the Model Integration.

No code required

Model Integrations are configured entirely from the UI — no service providers, no event classes, no observers. Just select the model, tick the events, and they are ready to use in any workflow.

2. Custom Laravel Events

Any Laravel event class can be used if it is registered by your application (or a plugin) via:

php
// In a service provider's boot() method
use Voodflow\Voodflow\Voodflow;

Voodflow::registerEvent(
    eventClass: \App\Events\OrderCreated::class,
    name: 'Order Created',
    description: 'Fired when a new order is placed',
    group: 'Orders',
);

The event class must have its payload as public properties. They are serialized automatically and injected as $context->input.

Custom Events Registration

Custom events are registered via code (or plugin bootstrapping) using Voodflow::registerEvent(). After registration, they automatically appear in the Event Trigger selector.

How It Works

  1. You configure the eventClass field with a registered event
  2. When your application dispatches that event, Voodflow's global listener intercepts it
  3. The event payload is serialized and injected as $context->input for the first downstream node
  4. A workflow execution is queued (or runs synchronously, depending on VOODFLOW_EXECUTE_SYNC)

Payload Example

Given a custom event:

php
class OrderCreated
{
    public function __construct(
        public Order $order,
        public User $customer
    ) {}
}

The execution context input will be:

json
{
    "order": {
        "id": 42,
        "total": 199.99,
        "status": "pending"
    },
    "customer": {
        "id": 7,
        "name": "Alice",
        "email": "alice@example.com"
    }
}

Eloquent model instances are automatically converted via ->toArray().

Validation

ConditionBehavior
eventClass is emptyValidation error: Event Class is required
Workflow is draftTrigger will not fire — must be set to active

Notes

  • One workflow listens to one event class. To react to the same event with multiple workflows, create multiple workflows each with an Event Trigger pointing to the same class.
  • Events are discovered at boot time from: the voodflow.registered_events config array, events registered via Voodflow::registerEvent(), and trigger nodes of active workflows.
  • If VOODFLOW_EXECUTE_SYNC=false, the event is handled asynchronously by a queue worker.

Proprietary software — source-available. All rights reserved.