I am building a saas project in which user is admin which subscribes the app and he can create projects, create clients and team members through invitation and assign the project to clients and team members. A client has many projects which is one to many relationship. Team member has many projects and project has many team members which is many to many relationship. When clients or team members login they see only projects that are assigned by the user. What I have done so far is.
USER table which contains login credentials of all users whether subsrciber, client or team member.
id | username | email | password | isAppAdmin | email_verified_at
Role table contains Subscriber, Client and Team member roles
id | name
role_id | permission_id
user_id | role_id
Subuser table which is currently has one to many relationship with User table and currently contains only clients.
subuser_id | user_id | email | username | userType | status
project_id | user_id | subuser_id | title
How to setup table between user and team members and projects which is many-to-many relationship between teammembers and projects. Should I make teammember table and relate projects table with teammember table for many-to-many relationship or I have to convert subuser table from one-to-many to many-to-many relationship and store team members and clients in subuser table. A client has many projects created by user(subscriber) but each project can have only one client. And a team member has many projects created by user(subscriber) and a project can have many team members.