Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix HasTeams trait to be able to use queries with('currentTeam') #173

Merged
merged 1 commit into from
Sep 13, 2020

Conversation

r2luna
Copy link
Contributor

@r2luna r2luna commented Sep 13, 2020

When adding with('currentTeam') to an eloquent builder an error happens:

CleanShot 2020-09-13 at 01 59 39@2x

The issue is because the currentTeam method is checking if the user has current_team_id in order to set the default current_team_id based on the personal team. However, since the builder isn't a user itself, it always tries to perform this action.

Adding the check to see if the id is there, we will make sure that is a single user and not a query.

CleanShot 2020-09-13 at 02 05 24@2x

@taylorotwell taylorotwell merged commit 7f48652 into laravel:1.x Sep 13, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants