Transitions

To perform a transition on a state machine, simply call a function with the name of the transition you specified in the machine spec. For example:

<?php
$order->state->pay();
?>

This will perform the pay transition and bring the state of the machine from placed to payed.

These transition functions accept parameters, which will be passed to Transition Monitors for processing.

<?php
$order->state->pay($gateway, $reference, $notes);
?>

Alternatively, you can call the process() method and specify the desired transition name.

<?php
$order->state->process('pay');

// or with parameters

$order->state->process('pay', $gateway, $reference, $notes);
?>