mpociot / teamwork

User to Team associations with invitation system for the Laravel 5 Framework
MIT License
1.07k stars 170 forks source link

team in multiple teams? #23

Closed hopewise closed 8 years ago

hopewise commented 8 years ago

Is there a possibility to assign a user to multiple teams? as you have used team_user table? is this supported with your package apis?

mpociot commented 8 years ago

Sure, since the user to teams relation is a hasMany relation, a user can join multiple teams.

Just call $user->attachTeam($team); multiple times.

To list all teams that the user has joined, you can access the relation through: $user->teams.

Also take a look at the documentation covering the topic of switching the current active team: https://github.com/mpociot/teamwork#switching-the-current-team

hopewise commented 8 years ago

Thank you!