brexis / laravel-workflow

Use the Symfony Workflow component in Laravel
MIT License
281 stars 105 forks source link

Have `workflow_transitions` return collection #66

Closed rlcurrall closed 4 years ago

rlcurrall commented 5 years ago

This is a quality of life improvement for developers who want to lean on Laravel's collections. I currently wrap the return of this function in a collection and would like the ability to have it function that way out of the box.

I don't believe this will introduce regressions in existing code.

rlcurrall commented 5 years ago

I actually am not fully sure how utilizing laravel helper functions will work in a package. I'm going to pull this code and try it out. Closing for now.

rlcurrall commented 5 years ago

It shouldn't be an issue using the collection helper function though if necessary I could modify the code to use the Collection facade directly. For example:

return Collection::make(Workflow::get($this, $workflow)->getEnabledTransitions($this));