Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Company Users #36

Open
drewroberts opened this issue Mar 1, 2021 · 2 comments
Open

Company Users #36

drewroberts opened this issue Mar 1, 2021 · 2 comments

Comments

@drewroberts
Copy link
Member

There will be a many to many relationship with a pivot table for Company (#13) and User (TIPOFF/authorization#20) and it will be implemented similar to Teams in Laravel Spark. There should also be additional fields in the pivot table:

  • timestamps
  • creator
  • updater
  • primary_contact (boolean)

The primary contact should only have one relationship with a true value per Company.

There will be a unique key for company_id and user_id.

@wolfrednicolas
Copy link
Contributor

wolfrednicolas commented Mar 1, 2021

@drewroberts

I created the pivot table with the values; however I don't understand what does it mean here

The primary contact should only have one relationship with a true value per Company.

here the migration
image

is this what its mean?

image

@drewroberts
Copy link
Member Author

I think the best way to implement that is on the model's saving boot method, where we'll just update the table to mark the other Users for that Company to false for the primary_contact boolean field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants