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

JuanDBB's avatar

[SOLVED] Adding users count to team in Vue

Hello,

How could I add to the teams property for my Vue components the number of users of each team?

Thank you in advance

0 likes
4 replies
richard's avatar

Please share some code so that we can see how you are doing it

JuanDBB's avatar

I got it, with:

    Spark::swap('TeamRepository@forUser', function ($user) {
        return $user->teams()->with('owner', 'users')->get();
    }); 
Cronix's avatar

If you mean the count of the users current team, it's already available to Vue: Spark.state.currentTeam.users.length

JuanDBB's avatar

Thank you Cronix. I wanted it in the teams property, not in the current team.

Please or to participate in this conversation.