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

Bug: Flexible content not working with Polymorphic Relationships #435

Open
Sauruz opened this issue Feb 9, 2023 · 0 comments
Open

Bug: Flexible content not working with Polymorphic Relationships #435

Sauruz opened this issue Feb 9, 2023 · 0 comments

Comments

@Sauruz
Copy link

Sauruz commented Feb 9, 2023

This module is really great. However, I found a bug. I've got Flexible content on my model Enrichments which looks like this:

class Enrichment extends Model {

    protected $casts = [
        'content' => FlexibleCast::class
    ];

    public function enrichable()
    {
        return $this->morphTo();
    }
} 

The table structure of enrichments looks like this:

id, enrichable_id, enrichable_type, intro, content

This model works great with the corresponding Nova resource. However, when I use the Enrichment resource in another Nova resource like this:

MorphOne::make('Enrichment'),

Saving flexible content doesn't work when you edit or update the resource. It will give the following error:
Unable to parse incoming Flexible content, data should be an array.

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