Skip to content

Docs: MorphTo, singularLabel and dependency container  #207

@preliot

Description

@preliot

Suggestion for improvement of documentation for MorphTo field:

If you want to depend on morphTo and use singularLabel() on your Nova resources, the dependency won't work if you follow documentation. The solution is you must depend on the singular label (and not the Model/Class name).

Example:

MorphTo::make('Commentable')->types([
    Post::class,
    Video::class,
]),

NovaDependencyContainer::make([
    Text::make('Additional Text', 'additional'),
    Boolean::make('Visible', 'visible')
])
->dependsOn('commentable', Post::singularLabel()) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions