brexis / laravel-workflow

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

Usage in blade template #31

Open eporsche opened 6 years ago

eporsche commented 6 years ago

Hi, this question was actually part of another issue, which has now been marked as being solved. However this part may still be open, that is why I want to repeat it as new issue.

Is There A way To Use: workflow_can() workflow_transitions() workflow_marked_places() workflow_has_marked_place()

in blade template ?

Like in the example of Symfony https://symfony.com/doc/current/workflow/usage.html

Thank's

riyuk commented 6 years ago

Well. I don't think it's a huge difference. In Symfony it's:

{% if workflow_can(post, 'publish') %}
    <a href="...">Publish article</a>
{% endif %}

In Blade it's:

@if($post->workflow_can('publish'))
    <a href="...">Publish article</a>
@endif