mpociot / teamwork

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

[Suggestion] Definable inviter in `inviteToTeam()` instead of just auth user #137

Closed poppabear8883 closed 2 years ago

poppabear8883 commented 3 years ago

https://github.com/mpociot/teamwork/blob/2869eca7a3e00ef8a2d755027c1a2e58dce67b5a/src/Teamwork.php#L67

Right now this method will only allow you to invite a user from the authenticated user. In some use-cases its necessary to allow the inviting user to be defined.

One example use-case is an administration usage. Maybe an admin needs to assist with creating a team and/or inviting users to their team.

You could allow it to fallback to the authenticated user if the inviter is null.

okaufmann commented 3 years ago

Hi,

Feel free to provide this functionality in a testet PR. I would review it as soon as possible.