Spark add team produces error in validator
I seem to have Spark set up correctly. I can register a user and a team is created for them with no problem. I have set up my own APIs to change team names, invite users to a team, remove users from a team, and do pretty much everything else.
However, when I try to add a team I get an error. The error is the same whether I use the settings page that Spark provides or I attempt to create a team via the proper URL. I wonder if maybe the error is related to using postgresql instead of mysql. The error is ...
QueryException in Connection.php line 729: SQLSTATE[42803]: Grouping error: 7 ERROR: column "teams.name" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...sers"."user_id" = $1 and "owner_id" = $2 order by "name" asc ^ (SQL: select count(*) as aggregate from "teams" inner join "team_users" on "teams"."id" = "team_users"."team_id" where "team_users"."user_id" = 7 and "owner_id" = 7 order by "name" asc)
Looking at the proper function in the Settings/Teams/TeamController, I find ...
/**
* Create a new team.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$team = $this->interaction($request, CreateTeam::class, [
$request->user(), $request->all()
]);
}
Tracing the problem down a little, I found that the error was produced in a function intended to insure that the user has not already created the maximum number of teams. The function is called validateMaximumTeamsNotExceeded. In the code shown below, there are 2 problems.
if ($plan->teams <= $user->ownedTeams()->count()) {
$validator->errors()->add('name', 'Please upgrade your subscription to create more teams.');
}
The first is that the part where the number of teams the user has - $user->ownedTeams()->count() - produces nothing. This triggers the error even though the user has not exceeded this number. The second is that the line to add the error produces the aforementioned Query Exception.
I can output the user fine, but it does not appear to have a count function?
Not sure what to do here as this seems like a big problem.
Please or to participate in this conversation.