Skip to content

Commit

Permalink
Merge pull request #34 from aymanterra/master
Browse files Browse the repository at this point in the history
 Fix workflow_transitions method in WorkflowTrait issue
  • Loading branch information
brexis authored Sep 24, 2019
2 parents 46b080f + f00ac67 commit 1396110
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/WorkflowTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 1396110

Please sign in to comment.