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

hard to find : how to setup a morph relationship? #501

Open
realtebo opened this issue Aug 23, 2023 · 0 comments
Open

hard to find : how to setup a morph relationship? #501

realtebo opened this issue Aug 23, 2023 · 0 comments

Comments

@realtebo
Copy link
Contributor

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

image

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant