-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nova resource double loading #1928
Comments
This is an issue with the package you're using. It registers its own Nova resource in addition to the one you've created. |
@davidhemphill |
You’re saying if a third-party package loads a resource into Nova, that we should somehow and detect that when you want to use your own? That doesn’t make sense. :-) If the package wants you to be able to extend it with your own resource, it should implement the feature itself. |
Oh my. Maybe my english even worse than I thought. I try to explain one more time. We have some 3rd-party package. It loads their own resource(s) controller from own directory. For example, //MenuBuilderServiceProvider.php
...
public function boot() {
...
Nova::resources([
config('nova-menu.resource', MenuResource::class),
]);
}
... nova-permission: //NovaPermissionTool.php
...
public function boot()
{
Nova::resources([
//this properties you can override when you register a tool with NovaServiceProvider->tools()
$this->roleResource,
$this->permissionResource,
]);
}
... As you can see, both packages let us use custom resource class.
and all you needs to do is to get rid of this duplicates: //Nova.php
public static function resources(array $resources)
{
static::$resources = array_unique(array_merge(static::$resources, $resources));
return new static;
} or maybe you can find a better solution. |
+1 it's annoying, and if resolution is that simple it's a shame to not have built-in. |
Description
When using nova packages with customizable resource controller, placing resource in App\Nova or creating it with nova:resource command causing
[vuex] duplicate getter key:
error and possible sidebar menu item duplication.Steps To Reproduce
Install laravel with nova, install any package with customizable resource:
Create resource
Adjus configuration
Placing resource outside of
App\Nova
directory solves this problem, but breaks application structure.The text was updated successfully, but these errors were encountered: