ChicaCactus's avatar

Creating a teams (companies) platform with santigarcor/laratrust?

Hi,

I'm creating a platform with Laravel that needs to have support for teams (companies) for example:

  • a. Captain America belongs to company Avengers and is the leader of the team.
  • b. Iron Man belongs to company Avengers and is the strategist of the team.
  • c. Spider Man belongs to company Avengers (as a regular employee) and Young Avengers as the leader of the team.

I'm thinking on using the package santigarcor/laratrust for managing the teams, roles and permissions but it seems to me that the "team" module was not developed for this usage.

For example, there's no documentation on how to get the "members of the team" or the "roles on the team", I'm sure that this can be developed but maybe there's a package that already fulfills this purpose.

Thanks for your feedback!

0 likes
2 replies
Tray2's avatar

You can solve that quite easy by having a good database model.

For example this is a structure I would start with.

  • You have a users table (heroes) that contains the name of the user/superhero
  • You have a teams table with all the teams (Avengers, Young Avengers and so on)
  • You have a roles table with all the roles (Leader, Worker and so on)
  • You have a teams_users pivot table with the team_id and user_id, and role_id (many to many)
ChicaCactus's avatar

Thanks for the reply! That's a great idea creating the team_user pivot table, so it really seems that the package still has some missing features or that at least this part has to be developed by the developer.

Please or to participate in this conversation.