Skip to content

Instantly share code, notes, and snippets.

@RafahCSilva
Last active September 20, 2019 21:10
Show Gist options
  • Select an option

  • Save RafahCSilva/5d5bb0402a157f5e32d4d13d88236b17 to your computer and use it in GitHub Desktop.

Select an option

Save RafahCSilva/5d5bb0402a157f5e32d4d13d88236b17 to your computer and use it in GitHub Desktop.
spatie/laravel-permission PhpStorm Blade directives (edit the file: `.idea/blade.xml`) (ref: https://docs.spatie.be/laravel-permission/v2/advanced-usage/phpstorm/)
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BladeInjectionConfiguration" default="false">
<directives>
<data directive="@role" injection="true" prefix="&lt;?php if(auth()-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;hasRole(" suffix=")): ?&gt;" />
<data directive="@elserole" injection="true" prefix="&lt;?php elseif(auth()-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;hasRole(" suffix=")): ?&gt;" />
<data directive="@endrole" />
<data directive="@hasrole" injection="true" prefix="&lt;?php if(auth()-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;hasRole(" suffix=")): ?&gt;" />
<data directive="@endhasrole" />
<data directive="@hasanyrole" injection="true" prefix="&lt;?php if(auth()-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;hasAnyRole(" suffix=")): ?&gt;" />
<data directive="@endhasanyrole" />
<data directive="@endhasallroles" />
<data directive="@hasallroles" injection="true" prefix="&lt;?php if(auth()-&gt;check() &amp;&amp; auth()-&gt;user()-&gt;hasAllRoles(" suffix=")): ?&gt;" />
<data directive="@unlessrole" injection="true" prefix="&lt;?php if(!auth()-&gt;check() || ! auth()-&gt;user()-&gt;hasRole(" suffix=")): ?&gt;" />
<data directive="@endunlessrole" />
</directives>
</component>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment