The definition
The definition defines what states and transitions exist for a specific model or set of models. There are two methods that need to be implemented for a definition class to work properly.
models
The models method has to return an array of model classnames that apply to this state machine definition.
public function models() : array
{
return [
Cat::class
];
}
mapping
The mapping simply lists all available State and Transition classes that apply.
public function mapping() : array
{
return [
'states' => [
Sleeping::class
],
'transitions' => [
WakesUp::class
]
];
}
Updated less than a minute ago