Transitions define how a model can move from one state to another. You configure these rules within the config() method of your state classes, which should return a StateConfig object.
Transitions can be simple (defining a source and destination state) or custom (providing a specific transition class to handle side effects or complex logic).
abstract class PaymentState extends State
{
public static function config(): StateConfig
{
return parent::config()
->allowTransition(Pending::class, Paid::class)
->allowTransition(Pending::class, Failed::class, PendingToFailed::class);
}
}