app/Teams/Team.php
public function removeUserById($userId)
    {
        $this->users()->detach([$userId]);

        $userModel = config('auth.model');

        $removedUser = (new $userModel)->find($userId);

        if ($removedUser) {
            $removedUser->refreshCurrentTeam();
        }
    }
public function removeUserById($userId)
    {
        $this->users()->detach([$userId]);

        $userModel = config('auth.model');

        $removedUser = (new $userModel)->find($userId);

        if ($removedUser) {
            $removedUser->refreshCurrentTeam();
        }
    }
Remove a user from the team by their ID.

@param  int  $userId
@return void