Getting "Laravel\Nova\Fields\BelongsTo::buildMorphableQuery does not exist" on a Polymorphic resource #6474
Unanswered
lukejwatts
asked this question in
Q&A
Replies: 3 comments
-
Bad relationship name here. |
Beta Was this translation helpful? Give feedback.
0 replies
-
So should it be |
Beta Was this translation helpful? Give feedback.
0 replies
-
From the documentation , and you can also refer to https://laravel.com/docs/11.x/eloquent-relationships#one-to-one-defining-the-inverse-of-the-relationship |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
I have a polymorhic table which has a belongs to relationship on it also. When I attempt to select the resource (project_phaseable_type) from the dropdown I get the following error:
I'm assuming it's because of the BelongsTo field in my fields array? Or I've set something up wrong (Please see the code snippets below for migrations, model and resource definitions)
Am I using the wrong morphTo/Many etc? The models relationships all work as expected for my use case which is many-to-many from the example, but it's actually a one-to-one relationship in practice.
Polymorphic Migration Schema
create_project_phases_table
migration:ProjectPhase model
ProjectPhase resource (fields)
Detailed steps to reproduce the issue on a fresh Nova installation:
Thanks in advance!
Luke
Beta Was this translation helpful? Give feedback.
All reactions