diff --git a/README.md b/README.md index c152a9c..90314b0 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,10 @@ $post->workflow_can('to_review'); // False foreach ($post->workflow_transitions() as $transition) { echo $transition->getName(); } +// if more than one workflow is defined for the BlogPost class +foreach ($post->workflow_transitions($workflowName) as $transition) { + echo $transition->getName(); +} // Apply a transition $post->workflow_apply('publish'); diff --git a/src/Traits/WorkflowTrait.php b/src/Traits/WorkflowTrait.php index 6a47a19..8edecc1 100644 --- a/src/Traits/WorkflowTrait.php +++ b/src/Traits/WorkflowTrait.php @@ -19,8 +19,8 @@ public function workflow_can($transition, $workflow = null) return Workflow::get($this, $workflow)->can($this, $transition); } - public function workflow_transitions() + public function workflow_transitions($workflow = null) { - return Workflow::get($this)->getEnabledTransitions($this); + return Workflow::get($this, $workflow)->getEnabledTransitions($this); } }