Duplicate navigation items when overriding a package resource.

In my package i've made shouldRegisterNavigation a config option like this
class ConsentOptionResource extends Resource
{
protected static ?string $model = ConsentOption::class;

public static function shouldRegisterNavigation(): bool
{
return config('filament-user-consent.navigation.consent_options.register');
}
class ConsentOptionResource extends Resource
{
protected static ?string $model = ConsentOption::class;

public static function shouldRegisterNavigation(): bool
{
return config('filament-user-consent.navigation.consent_options.register');
}
Which hides menu item when set to false. We've then created a local override for this file due to client customisation requirements and set shoudRegisterNavigation to true
use Visualbuilder\FilamentUserConsent\Resources\ConsentOptionResource as BaseConsentOptionResource;

class ConsentOptionResource extends BaseConsentOptionResource
{
protected static ?string $model = ConsentOption::class;

public static function shouldRegisterNavigation(): bool
{
return true;
}
use Visualbuilder\FilamentUserConsent\Resources\ConsentOptionResource as BaseConsentOptionResource;

class ConsentOptionResource extends BaseConsentOptionResource
{
protected static ?string $model = ConsentOption::class;

public static function shouldRegisterNavigation(): bool
{
return true;
}
But for some reason this duplicates the menu item in the cluster. I've tried setting shouldRegisterNavigation to false and manually registering the nav item in the panel config but it looks like clusters aren't yet supported in
Filament\Navigation\NavigationItem
Filament\Navigation\NavigationItem
so I it won't show in the correct menu. Anyone else had this issue or can suggest a solution? Thanks
Solution:
Haha - idiot user error, resource was being registered twice.
Jump to solution
1 Reply
Solution
acroninja
acroninja5w ago
Haha - idiot user error, resource was being registered twice.