F
Filament10mo ago
ПIᄃK

Filament shield not in Navigation

Hello, I have a short queston: my shield tab ist showing up on the navigation. These are my settings im the filament-shield.php config:
'shield_resource' => [
'should_register_navigation' => true,
'slug' => 'shield/roles',
'navigation_sort' => -1,
'navigation_badge' => true,
'navigation_group' => true,
'is_globally_searchable' => false,
'show_model_path' => true,
],
'shield_resource' => [
'should_register_navigation' => true,
'slug' => 'shield/roles',
'navigation_sort' => -1,
'navigation_badge' => true,
'navigation_group' => true,
'is_globally_searchable' => false,
'show_model_path' => true,
],
and on oy language file:
'nav.group' => 'Management',
'nav.role.icon' => 'heroicon-o-shield-check',
'nav.role.label' => 'Rollen',
'resource.label.role' => 'Rolle',
'resource.label.roles' => 'Rollen',
'nav.group' => 'Management',
'nav.role.icon' => 'heroicon-o-shield-check',
'nav.role.label' => 'Rollen',
'resource.label.role' => 'Rolle',
'resource.label.roles' => 'Rollen',
but on my naviagtion there is no shield tab visible. Did someone know why?
No description
5 Replies
toeknee
toeknee10mo ago
Setup a ploicy to ensure you have access to manage it?
ПIᄃK
ПIᄃKOP10mo ago
Yes I have the default RolePolicy:
<?php

namespace App\Policies;

use App\Models\User;
use Spatie\Permission\Models\Role;
use Illuminate\Auth\Access\HandlesAuthorization;

class RolePolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
return $user->can('view_any_role');
}

/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \Spatie\Permission\Models\Role $role
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Role $role)
{
return $user->can('view_role');
}
...
<?php

namespace App\Policies;

use App\Models\User;
use Spatie\Permission\Models\Role;
use Illuminate\Auth\Access\HandlesAuthorization;

class RolePolicy
{
use HandlesAuthorization;

/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
return $user->can('view_any_role');
}

/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \Spatie\Permission\Models\Role $role
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Role $role)
{
return $user->can('view_role');
}
...
toeknee
toeknee10mo ago
And are you sure the user is assigned to view_any_role
ПIᄃK
ПIᄃKOP10mo ago
I thought the super_admin user has all permissions. But it correct me if I’m wrong
toeknee
toeknee10mo ago
It dpends how it's been configured
Want results from more Discord servers?
Add your server