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?
36 Replies
Check the config file
i have done it more than once nothing is working.
#bezhansalleh-shield likely a configuration option with the plugin
You’re getting 2 of them because your override is in the panel autodiscovery path.
Why did you publish the resource? You can change the group via config.
I didn't get it enlighten me please?
You published the resource. That’s why you have 2. Your own and the one from the plugin.
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 ?
Read my message above: Why do you publish at all? You can change most stuff via config.
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.
So is this solved now?
no still i have those 2 roles resource .
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
What did you do? You removed your published resource?
no i didn't removed my published resource.
Well, how should it be fixed, if you didn't change anything?!
i already done some changed but it didn't fix the error , so are you saying removing the published resource would fix the error?
Yes, probably.
OK good , so how i can remove the published resource ?
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-shieldDelete the file(s)? 😅
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.
if i change should_register_navigation = false , both of them will not be visible ?
But they will be when you update the resources to should = true.
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 .
Change it to false, publish the role resource and set to true…
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 .
Set the navigation group in the config file above…. Or in the resource as per the docs
i think the navigation group in the config file can only be set to true of false.
Yep but the language string can be overridden:
__('filament-shield::filament-shield.nav.group')
as per the source code
i didn't get , for example i change the navigation group in the config file to this :
and nothing is changing.
Ah, sorry. Thought this was to set the translation. Then publish the translation file
which translation file?
Shield's. See toeknee's answer. Publish it and adjust the group etc.
did you mean publish the role resource then adjust the navigation group in the config?
No. Don't publish the role resource. Publish the translation file. Adjust the translations.