From 18afe13aa8a6585461f12f11e9c34178cd2f38b7 Mon Sep 17 00:00:00 2001 From: Zayn Ali Date: Sat, 2 Jul 2016 02:54:32 +0500 Subject: [PATCH] Add (ACL) cannot directive --- blade.sublime-syntax | 4 ++-- test.blade | 7 +++++-- test.blade.php | 7 +++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/blade.sublime-syntax b/blade.sublime-syntax index 695812c..ba2701e 100644 --- a/blade.sublime-syntax +++ b/blade.sublime-syntax @@ -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 @@ -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 diff --git a/test.blade b/test.blade index d3031d0..0901bb2 100644 --- a/test.blade +++ b/test.blade @@ -253,7 +253,7 @@ This comment will not be in the rendered HTML @endminify -{{----------------------------------------}} +{{-- Authorization (ACL) --}} @can('permission', $entity) You have permission! @@ -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) diff --git a/test.blade.php b/test.blade.php index d3031d0..0901bb2 100644 --- a/test.blade.php +++ b/test.blade.php @@ -253,7 +253,7 @@ @endminify -{{----------------------------------------}} +{{-- Authorization (ACL) --}} @can('permission', $entity) You have permission! @@ -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)