Filament Shield, how to create different permissions in same role
Hi There,
i am using Filament Shield,
my question is:
how to create different permissions in same role?
example:
Role: USER
Permission
User: John Resources: Brand Can: Create, Read, Update
User: Doe Resources: Brand Can: Read, Update, Deletehow to achieve that? Thankyou
Solution:Jump to solution
yes, thankyou @Vp for your help
i use php artisan permission:show to list out all of the permission
and i wrong , not view_any::users but view_any_other::user
because i put User.php in 'other'...
17 Replies
Ask in #shield but I don't think it's possible so suggested you to create two roles. Eg: 1. Brand_Creator (create, read, update), 2. Brand_Del (read, update, delete) etc.. and assign different roles on different user
And please don't spam your question.. you need to be patient
thankyou for your answer Sir,
i have another question Sir,
why user resources doesn't show in navbar?this is my User.php (app > models > User.php) and this is my UserPolicy.php (app > policies > UserPolicy.php) and my AuthServiceProvider: can you help me Sir?
it must be appear below of "Youtubes" Menu (Other)

Post user resource
ManageUsers.php (app > filament > resources > other > userresource > pages)
UserResource.php (app > filament > resources > other)
Weird, base on your code it should display.. any cache issue?
already clear cache using
but still not working,
any solution Sir?
or maybe i have wrong in my code?
A resource won't show in the nav menu if the
viewAny
permission in the Policy returns false. Perhaps the user you're testing with doesn't have the permission?@DrByte in this capture,
the user already have the permission
all of the permission in UserResources

Try returning
true
from viewAny()
in your UserPolicy
.okay Sir, i'll try
it's work Sir
this is my code after modified

Okay, then that means that either the user doesn't have the permission, or your
can('view_any::user')
is wrong. You will have to investigate why.Okay, thankyou so much.
i will investigate the permission.
It should be something like this
view_any_user::other::user
Just run shield:generate
and it'll reformat the permission name..Solution
yes, thankyou @Vp for your help
i use php artisan permission:show to list out all of the permission
and i wrong , not view_any::users but view_any_other::user
because i put User.php in 'other'