Skip to content

Commit

Permalink
Merge pull request #4 from fbrissi/bugfix/view_any_role_and_premission
Browse files Browse the repository at this point in the history
Implementation hide Roles and Permissions in menu when with viewAny.
  • Loading branch information
bajramemini authored Apr 29, 2019
2 parents dabad6a + 2748e56 commit 077437a
Showing 1 changed file with 38 additions and 31 deletions.
69 changes: 38 additions & 31 deletions resources/views/navigation.blade.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@

<h3 class="flex items-center font-normal text-white mb-6 text-base no-underline">
<svg class="sidebar-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="var(--sidebar-icon)"
d="M7 10V7a5 5 0 1 1 10 0v3h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8c0-1.1.9-2 2-2h2zm2 0h6V7a3 3 0 0 0-6 0v3zm-4 2v8h14v-8H5zm7 2a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1z"/>
</svg>
<span class="sidebar-label">
{{ __('Roles & Permissions') }}
</span>
</h3>
@canany('viewAny', Spatie\Permission\Models\Role::class, 'viewAny', Spatie\Permission\Models\Permission::class)
<h3 class="flex items-center font-normal text-white mb-6 text-base no-underline">
<svg class="sidebar-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="var(--sidebar-icon)"
d="M7 10V7a5 5 0 1 1 10 0v3h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8c0-1.1.9-2 2-2h2zm2 0h6V7a3 3 0 0 0-6 0v3zm-4 2v8h14v-8H5zm7 2a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1z"/>
</svg>
<span class="sidebar-label">
{{ __('Roles & Permissions') }}
</span>
</h3>

<ul class="list-reset mb-8">
<ul class="list-reset mb-8">

<li class="leading-wide mb-4 text-sm">
<router-link :to="{
name: 'index',
params: {
resourceName: 'roles'
}
}" class="text-white ml-8 no-underline dim">
{{ __('Roles') }}
</router-link>
</li>
@can('viewAny', Spatie\Permission\Models\Role::class)
<li class="leading-wide mb-4 text-sm">
<router-link :to="{
name: 'index',
params: {
resourceName: 'roles'
}
}" class="text-white ml-8 no-underline dim">
{{ __('Roles') }}
</router-link>
</li>
@endcan

<li class="leading-wide mb-4 text-sm">
<router-link :to="{
name: 'index',
params: {
resourceName: 'permissions'
}
}" class="text-white ml-8 no-underline dim">
{{ __('Permissions') }}
</router-link>
</li>
@can('viewAny', Spatie\Permission\Models\Permission::class)
<li class="leading-wide mb-4 text-sm">
<router-link :to="{
name: 'index',
params: {
resourceName: 'permissions'
}
}" class="text-white ml-8 no-underline dim">
{{ __('Permissions') }}
</router-link>
</li>
@endcan

</ul>
@endcanany

</ul>

0 comments on commit 077437a

Please sign in to comment.