Closed lukejwatts closed 4 months ago
BelongsTo::make('Phase', 'projectPhaseable', Phase::class),
Bad relationship name here.
BelongsTo::make('Phase', 'projectPhaseable', Phase::class),
Bad relationship name here.
So should it be BelongsTo::make('Phase', 'projectPhase', Phase::class)
or something else?
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
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