Skip to content
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

Unable to load correct Nova Resource with nested resources with same class names #6584

Closed
gcg opened this issue Nov 20, 2024 · 4 comments
Closed
Labels
needs more info More information is required stale

Comments

@gcg
Copy link

gcg commented Nov 20, 2024

  • Laravel Version: v11.33.2
  • Nova Version: v4.35.4
  • PHP Version: 8.3.13

Description:

Lets say you have a class with same name as resources in different sub resource namespace/folders (eg: 'App\Nova\Resources\XXX\LogandApp\Nova\Resources\YYY\Log`)

Even though I am explicly setting 3rd param on HasMany with both class

      HasMany::make('Logs', 'logs', Log::class),

and i tried with string

      HasMany::make('Logs', 'logs', 'App\Nova\XXX\Log'),

However, even though the data that log loaded is for the correct eloquent model (since eloquent relationships are not effected the same way nova resources are), the resource is not right so I can only see the matching fields between 2 resources.

@crynobone
Copy link
Member

Laravel Nova doesn't support using the same attribute for multiple field such as above as attribute is consider a unique identifier in this case.

@gcg
Copy link
Author

gcg commented Nov 20, 2024

Laravel Nova doesn't support using the same attribute for multiple field such as above as attribute is consider a unique identifier in this case.

The field is not multiple, each resource lives their own namespace directory under app/Nova. (XXX model/resource lives in app/models/xxx/XXX and app/models/xxx/log and YYY model lives in its own directory app/models/yyy/yyy and app/models/yyy/log same structure for the nova resources as well. and YYY resource hasmany logs loads the log explicitly, same with XXX.)

So unless you are not talking about system wide uniqueness, it should work since each class has a unique namespace.

@crynobone
Copy link
Member

Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

@crynobone crynobone added needs more info More information is required stale labels Nov 20, 2024
@crynobone
Copy link
Member

Hey there,

We're closing this issue because it's inactive, already solved, old, or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.

@crynobone crynobone closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info More information is required stale
Projects
None yet
Development

No branches or pull requests

2 participants