app/Http/Controllers/Settings/TeamController.php
public function updateTeamMember(Request $request, $teamId, $userId)
    {
        $user = $request->user();

        $team = $user->teams()
                ->where('owner_id', $user->id)->findOrFail($teamId);

        $userToUpdate = $team->users->find($userId);

        if (! $userToUpdate) {
            abort(404);
        }

        $this->validateTeamMemberUpdate($request, $team, $userToUpdate);

        if (Spark::$updateTeamMembersWith) {
            $this->callCustomUpdater(Spark::$updateTeamMembersWith, $request, [$team, $userToUpdate]);
        } else {
            $userToUpdate->teams()->updateExistingPivot(
                $team->id, ['role' => $request->role]
            );
        }

        return $this->teams->getTeam($user, $teamId);
    }
public function updateTeamMember(Request $request, $teamId, $userId)
    {
        $user = $request->user();

        $team = $user->teams()
                ->where('owner_id', $user->id)->findOrFail($teamId);

        $userToUpdate = $team->users->find($userId);

        if (! $userToUpdate) {
            abort(404);
        }

        $this->validateTeamMemberUpdate($request, $team, $userToUpdate);

        if (Spark::$updateTeamMembersWith) {
            $this->callCustomUpdater(Spark::$updateTeamMembersWith, $request, [$team, $userToUpdate]);
        } else {
            $userToUpdate->teams()->updateExistingPivot(
                $team->id, ['role' => $request->role]
            );
        }

        return $this->teams->getTeam($user, $teamId);
    }
Update a team member on the given team.

@param  \Illuminate\Http\Request  $request
@param  string  $teamId
@param  string  $userId
@return \Illuminate\Http\Response