Filament-Shield Error Showing Two Roles Resource

so in my navigation resources i am having two roles rosource i already published the roles resource and changed the navigation group to 'Authentication' and i dont know where the Filament-Shield navigation group came out. so how to solve it?
No description
36 Replies
Expecto Patronum
Check the config file
Abuukar
AbuukarOP3w ago
i have done it more than once nothing is working.
Dan Mason
Dan Mason3w ago
#bezhansalleh-shield likely a configuration option with the plugin
awcodes
awcodes3w ago
You’re getting 2 of them because your override is in the panel autodiscovery path.
Dennis Koch
Dennis Koch3w ago
Why did you publish the resource? You can change the group via config.
Abuukar
AbuukarOP3w ago
I didn't get it enlighten me please?
Dennis Koch
Dennis Koch3w ago
You published the resource. That’s why you have 2. Your own and the one from the plugin.
Abuukar
AbuukarOP3w ago
in other projects i also published the resource and i didn't have this 2 , i always publish resource . i always publish the role resouce and i didn't get this 2 , except for this time , so now is there is a way to solve it ?
Dennis Koch
Dennis Koch3w ago
Read my message above: Why do you publish at all? You can change most stuff via config.
Abuukar
AbuukarOP3w ago
I publishe resources so i can see and change the navigationGroup and navigationSort , on the other hand I didn't know that I can change the those stuff via config file.
Dennis Koch
Dennis Koch3w ago
So is this solved now?
Abuukar
AbuukarOP3w ago
no still i have those 2 roles resource .
No description
Dan Mason
Dan Mason3w ago
The package should only be registering the package resource if it is not published. It uses this method to check if the panel already contains a RoleResource. https://github.com/bezhanSalleh/filament-shield/blob/8110cf901114703006ed56872ce46e1405c4efd5/src/Support/Utils.php#L20
Dennis Koch
Dennis Koch3w ago
What did you do? You removed your published resource?
Abuukar
AbuukarOP3w ago
no i didn't removed my published resource.
Dennis Koch
Dennis Koch3w ago
Well, how should it be fixed, if you didn't change anything?!
Abuukar
AbuukarOP3w ago
i already done some changed but it didn't fix the error , so are you saying removing the published resource would fix the error?
Dennis Koch
Dennis Koch3w ago
Yes, probably.
Abuukar
AbuukarOP3w ago
OK good , so how i can remove the published resource ?
toeknee
toeknee3w ago
GitHub
filament-shield/config/filament-shield.php at 3.x · bezhanSalleh/fi...
The easiest and most intuitive way to add access management to your Filament Panel; Resources, Pages & Widgets through spatie/laravel-permission - bezhanSalleh/filament-shield
Dennis Koch
Dennis Koch3w ago
Delete the file(s)? 😅
toeknee
toeknee3w ago
Navigtion sort and group are defined there. If you want to override them like you did you would set: should_register_navigation = false. and use your own.
Abuukar
AbuukarOP3w ago
if i change should_register_navigation = false , both of them will not be visible ?
toeknee
toeknee3w ago
But they will be when you update the resources to should = true.
Abuukar
AbuukarOP3w ago
ok but i only want to show one role resource , if i change to false both of the will not be visible and if i change to true i will se both of them .
toeknee
toeknee3w ago
Change it to false, publish the role resource and set to true…
Abuukar
AbuukarOP3w ago
i deleted the published resource so now i have the role resource inside the Filament Shield navigation group so how to change the navigation group to something else like Authentication? i tried this way but at the time i set it to true i see both of them .
toeknee
toeknee3w ago
Set the navigation group in the config file above…. Or in the resource as per the docs
Abuukar
AbuukarOP3w ago
i think the navigation group in the config file can only be set to true of false.
toeknee
toeknee3w ago
Yep but the language string can be overridden: __('filament-shield::filament-shield.nav.group') as per the source code
Abuukar
AbuukarOP3w ago
i didn't get , for example i change the navigation group in the config file to this :
'navigation_group' => 'Authentication',
'navigation_group' => 'Authentication',
and nothing is changing.
Dennis Koch
Dennis Koch3w ago
Ah, sorry. Thought this was to set the translation. Then publish the translation file
Abuukar
AbuukarOP3w ago
which translation file?
Dennis Koch
Dennis Koch3w ago
Shield's. See toeknee's answer. Publish it and adjust the group etc.
Abuukar
AbuukarOP3w ago
did you mean publish the role resource then adjust the navigation group in the config?
Dennis Koch
Dennis Koch2w ago
No. Don't publish the role resource. Publish the translation file. Adjust the translations.

Did you find this page helpful?