Skip to content

Commit

Permalink
Add (ACL) cannot directive
Browse files Browse the repository at this point in the history
  • Loading branch information
zaynali53 committed Jul 1, 2016
1 parent f800fb0 commit 18afe13
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions blade.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contexts:
pop: true
- include: 'scope:source.php'

- match: '(\s{0}|^)(\@)\b(debug|embed|macrodef|set|unset|if|elseif|forelse|foreach|for|while|extends|unless|each|yield|lang|choice|section|include|render|block|can|inject|partial|hasSection|elsecan|elsecannot|stack|push|layout|continue|break|minify|macro)\b(?=(|\s*|)\()'
- match: '(\s{0}|^)(\@)\b(debug|embed|macrodef|set|unset|if|elseif|forelse|foreach|for|while|extends|unless|each|yield|lang|choice|section|include|render|block|can|cannot|inject|partial|hasSection|elsecan|elsecannot|stack|push|layout|continue|break|minify|macro)\b(?=(|\s*|)\()'
captures:
0: entity.name.tag.block.any.html
1: constant.other.inline-data.html
Expand All @@ -47,7 +47,7 @@ contexts:
pop: true
- include: 'scope:source.php'

- match: '(\s{0}|^)(\@)\b(breakpoint|endmacro|endembed|empty|endif|endforelse|endforeach|endfor|endwhile|else|endunless|show|stop|endblock|endpartial|continue|break|endsection|parent|overwrite|endcan|append|endpush|markdown|endmarkdown|endminify)\b'
- match: '(\s{0}|^)(\@)\b(breakpoint|endmacro|endembed|empty|endif|endforelse|endforeach|endfor|endwhile|else|endunless|show|stop|endblock|endpartial|continue|break|endsection|parent|overwrite|endcan|endcannot|append|endpush|markdown|endmarkdown|endminify)\b'
scope: custom.compiler.blade.php
captures:
0: entity.name.tag.block.any.html
Expand Down
7 changes: 5 additions & 2 deletions test.blade
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ This comment will not be in the rendered HTML
@endminify
</style>

{{----------------------------------------}}
{{-- Authorization (ACL) --}}

@can('permission', $entity)
You have permission!
Expand All @@ -265,7 +265,10 @@ This comment will not be in the rendered HTML
You don't have permission!
@endcan

{{-- elsecan and elsecannot --}}
@cannot ('update', [ 'post' => $post ])
breeze
@endcannot

@can ('show-post', $post)
Can Show
@elsecan ('write-post', $post)
Expand Down
7 changes: 5 additions & 2 deletions test.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
@endminify
</style>

{{----------------------------------------}}
{{-- Authorization (ACL) --}}

@can('permission', $entity)
You have permission!
Expand All @@ -265,7 +265,10 @@
You don't have permission!
@endcan

{{-- elsecan and elsecannot --}}
@cannot ('update', [ 'post' => $post ])
breeze
@endcannot

@can ('show-post', $post)
Can Show
@elsecan ('write-post', $post)
Expand Down

0 comments on commit 18afe13

Please sign in to comment.