Skip to content

Self-Referential belongsToMany method on Model #16

Description

@gn0rt0n
public function fields(Request $request)
{
    return [
        NestedTreeAttachManyField::make('Offer Categories',"categories","App\Nova\Category"),
    ];
}

It looks like the second parameter should be the method on the categories class that defines the self-referential relationship. It requires a belongsToMany to be returned.

However, I don't see the specifics for defining that method in the https://github.com/lazychaser/laravel-nestedset documentation, or from your documentation.

Is this a method provided by the nestedset trait? If so, what is the name?

If not, could you provide an example of the relationship method that needs to be defined. i.e. \App\Models\Category->categories()

Thanks,
Gary

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions