diff --git a/src/Mpociot/Teamwork/Traits/UsedByTeams.php b/src/Mpociot/Teamwork/Traits/UsedByTeams.php index 7a1518d..b328ef1 100644 --- a/src/Mpociot/Teamwork/Traits/UsedByTeams.php +++ b/src/Mpociot/Teamwork/Traits/UsedByTeams.php @@ -26,7 +26,7 @@ protected static function bootUsedByTeams() static::addGlobalScope('team', function (Builder $builder) { static::teamGuard(); - $builder->where('team_id', auth()->user()->currentTeam->getKey()); + $builder->where($builder->getQuery()->from . '.team_id', auth()->user()->currentTeam->getKey()); }); static::saving(function (Model $model) {