Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation hide Roles and Permissions in menu when with viewAny. #4

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>