Skip to content

Many to many relation with additional field in pivot table? #527

@pavel-mironchik

Description

@pavel-mironchik

Hi. I don't see a way to set a value for an additional field in a pivot table, e.g. type in this example:

static fields() {
    return {
      roleId: this.attr(null),
      userId: this.attr(null),
      type: this.attr("")
    };
  }

I prepared a sandbox: https://codesandbox.io/s/vuex-orm-sample-application-8xbyg
The data structure is actually the same that Laravel returns when you use the return $this->belongsToMany('App\User')->withPivot('type'); statement.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestreleasedThe issue was implemented and it is released publicly

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions