Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mikecurry74's avatar

maxTeams not working, causing issues (Exception!)

I've set maxTeams(2) on my plan, and when this is there, it prevents me from adding any teams at all. The Create button just kind of flashes and does nothing. I did not create using the --teem extension but followed directions on how to enable it after.

However, maxTeamMembers(5) works as expected!

Update: there are errors...

Next Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause (SQL: select count(*) as aggregate from `teams` inner join `team_users` on `teams`.`id` = `team_users`.`team_id` where `team_users`.`user_id` = 1 and `owner_id` = 1 order by `name` asc) in /home/ubuntu/www/realtor-crm/vendor/laravel/framework/src/Illuminate/Database/Connection.php:647
0 likes
2 replies
rileybolen123's avatar

I just figured it out. The error was caused by calling the count method on the collection of owned teams in the spark/src/Http/Requests/Settings/Subscription/DeterminesPlanEligibility.php file. Here is the line that I think caused the error.

return $plan->teams < $this->user()->ownedTeams()->count();

Here is what I replaced it with.

$users_teams = $this->user()->ownedTeams();
        $team_count = 0;
        foreach ($users_teams as $each_team) {
          $team_count++;
        }

        return $plan->teams < $team_count;

Note that you will also need to do a similar fix in the spark/src/Interactions/Settings/Teams/CreateTeam.php file. I'm not sure if this solution is best practice but it is working well for me. If anyone has a better solution or can explain why the count method wasn't working please let me know.

Please or to participate in this conversation.