docs
docs copied to clipboard
hard to find : how to setup a morph relationship?
I have a movements
table and the Movement
model class
This table has fields for morphing
- coinable_type
- coinable_id
This model class has relationship
public function coinable(): MorphTo
{
return $this->morphTo();
}
Then I am trying to add the morph related fields using this in the setupCreateOperation
CRUD::field([
'type' => 'relationship',
'name' => 'coinable',
]);
I got the error
Undefined array key "morphOptions"
From \vendor\backpack\pro\resources\views\fields\relationship\morphTo.blade.php: 21
I am in the page where the relationship field is documented.
I kindly suggest to add a backlink to
https://backpackforlaravel.com/docs/6.x/crud-how-to#morphto-n-1-relationship
or the upper
https://backpackforlaravel.com/docs/6.x/crud-how-to#what-field-should-i-use-for-a-relationship-1
because until now we didn't know the existence of this FAQ.
I suggest before or after this point
to add a link to point developers to the relevant faq
The actual link points to https://backpackforlaravel.com/docs/6.x/crud-fields#optional-attributes-for-fields-containing-related-entries
And this is absolutely needed. But a second link pointing to faq about morph will be usefull..