mpociot / teamwork

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

Move team guard check to the actual use case #116

Closed mbardelmeijer closed 4 years ago

mbardelmeijer commented 4 years ago

This pull request adds the ability to add factories in combination with teams. As we're creating a instance with a team attached in our factory, but no one is authenticated at the moment, the saving closure triggers the 'No authenticated user with selected team present.'

This ensures the check is only done when necessary, that case would be when the team actually needs to be fetched from the authenticated user.

okaufmann commented 4 years ago

Thanks for your PR!