laravel-eloquent-state-machines icon indicating copy to clipboard operation
laravel-eloquent-state-machines copied to clipboard

Added ability to use wildcard in allowed state changes

Open jezzdk opened this issue 3 years ago • 0 comments

Summary

This will add functionality that allows the user to use wildcards when defining state changes. This can prove useful if you have a lot of states and you dont want to type them all in when everything is allowed. For example:

// If it should be possible to change from any state to a given state:
return [
    '*' => [
        'approved'
    ],
];

// If it should be possible to change to any state from the 'pending' state:
return [
    'pending' => '*',
];

// If it should be possible to change to and from any state whatsoever:
return [
    '*' => '*',
];

Type of Change

  • [X] :rocket: New Feature
  • [ ] :bug: Bug Fix
  • [ ] :hammer: Refactor
  • [ ] :question: [Other]

jezzdk avatar Dec 20 '21 21:12 jezzdk