1 回答

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊
嘗試這種關(guān)系:
團(tuán)隊(duì)模型:
public function teams(){
return $this->belongsToMany('App\Team', 'team_members', 'team_id', 'user_id')
->as('details')
->withPivot('instrument_user_id', 'is_leader')
->using('App\TeamMember');
}
團(tuán)隊(duì)模型:
public function members()
{
return $this->belongsToMany('\App\User', 'team_members', 'user_id', 'team_id')
->as('details')
->withPivot('instrument_user_id','is_leader')
->using('App\TeamMember');
}
- 1 回答
- 0 關(guān)注
- 117 瀏覽
添加回答
舉報(bào)