Remove users

@param User ...$users

@return $this
483271
public function removeUsers(User ...$users)
    {
        foreach ($users as $user) {
            $this->getUsers()->removeElement($user);
        }

        return $this;
    }
154105
public function setUser($user)
    {
        $this->removeTarget();

        if ($user) {
            $this->user = (string) $user;
        }

        return $this;
    }
1028634
public function detachPermissions($permissions = null)
    {
        if (!$permissions) {
            $permissions = $this->permissions()->get();
        }

        foreach ($permissions as $permission) {
            $this->detachPermission($permission);
        }

        return $this;
    }
1264000
public function removeUser(ServerUser $user)
    {
        if ($this->users->contains($user) === true) {
            $user->setServer(null);
            $this->users->removeElement($user);
        }

        return $this;
    }
746410
public function remove(User $user)
    {
        $this->entityManager->remove($user);
        $this->entityManager->flush($user);
    }
1305364
public function destroy(User $user)
    {
        $this->authorize('delete', $user);

        $user->delete();

        File::delete(public_path('/avatars/'.md5($user->email)));

        return redirect()->route('laralum::users.index')->with('success', __('laralum_users::general.user_deleted', ['id' => $user->id]));
    }
873236
public function remove( $classs ) {
		if ( isset( $this->mapping[ $classs ] ) ) {
			unset( $this->mapping[ $classs ] );
		}
		return $this;
	}
706184
private function deleteSessions(Entity\Users $user)
    {
        $savePath = $this->sessionStorage->getOptions()->get('save_path');
        try {
            $sessionFiles = $this->filesystem->find()->files()->in($savePath);
        } catch (FileNotFoundException $e) {
            return;
        }

        /** @var \Bolt\Filesystem\Handler\File $sessionFile */
        foreach ($sessionFiles as $sessionFile) {
            $data = Serialization::parse($sessionFile->read());
            if (!isset($data['_sf2_attributes']['authentication'])) {
                continue;
            }
            if (!$data['_sf2_attributes']['authentication'] instanceof Token) {
                continue;
            }
            /** @var \Bolt\AccessControl\Token\Token $token */
            $token = $data['_sf2_attributes']['authentication'];
            if ($token->getUser()->getId() === $user->getId()) {
                $sessionFile->delete();
            }
        }
    }
1068672
public function addUser(User $user)
    {
        if (!$this->users->contains($user)) {
            $this->users->add($user);
        }

        return $this;
    }
940874
public function detachUser( $user )
  {
    if( is_object($user))
      $user = $user->getKey();

    if( is_array($user))
      $user = $user['id'];

    $this->users()->detach( $user );
  }
1119831
public function removeMyFriends(Collection $users)
    {
        foreach ($users as $user) {
            $this->removeMyFriend($user);
        }

        return $this;
    }
939131
public function destroy($user)
    {
        $user = User::find($user);
        if (!$user) {
            return redirect_to_resource();
        }

        $this->deleteEntry($user, request());

        return redirect_to_resource();
    }
1245226
public function deleteUser(User $user)
    {

        /* When the api will identify a user, please uncomment this
        if ($this->container->get('security.token_storage')->getToken()->getUser()->getId() === $user->getId()) {
            throw new \Exception('A user cannot delete himself');
        }*/
        $userRole = $this->roleManager->getUserRoleByUser($user);

        //soft delete~
        $user->setMail('mail#' . $user->getId());
        $user->setFirstName('firstname#' . $user->getId());
        $user->setLastName('lastname#' . $user->getId());
        $user->setPlainPassword(uniqid());
        $user->setUsername('username#' . $user->getId());
        $user->setPublicUrl('removed#' . $user->getId());
        $user->setAdministrativeCode('code#' . $user->getId());
        $user->setIsEnabled(false);

        // keeping the user's workspace with its original code
        // would prevent creating a user with the same username
        // todo: workspace deletion should be an option
        $ws = $user->getPersonalWorkspace();

        if ($ws) {
            $ws->setCode($ws->getCode() . '#deleted_user#' . $user->getId());
            $ws->setDisplayable(false);
            $this->objectManager->persist($ws);
        }

        if ($userRole) {
            $this->objectManager->remove($userRole);
        }
        $this->objectManager->persist($user);
        $this->objectManager->flush();

        $this->strictEventDispatcher->dispatch('claroline_users_delete', 'GenericDatas', array(array($user)));
        $this->strictEventDispatcher->dispatch('log', 'Log\LogUserDelete', array($user));
        $this->strictEventDispatcher->dispatch('delete_user', 'DeleteUser', array($user));
    }
619296
public function trash($user)
    {
        return MessageNotification::where('user_id', $user->getKey())
            ->where('message_id', $this->id)
            ->delete();
    }
439254
public function remove( ...$items )
	{

		foreach ( $items as $item )
		if ( ( $index = $this->indexOf( $item ) ) !== null )
			unset( $this->items[ $index ] );

		return $this;
	}
342999
public function deleteUser($user)
    {

        $sql = "DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' ' .
               'WHERE (user_pk = :id)';
        $query = $this->db->prepare($sql);
        $query->bindValue('id', $user->getRecordId(), PDO::PARAM_INT);
        $ok = $query->execute();

        if ($ok) {
            $user->initialize();
        }

        return $ok;

    }
1246598
public function remove(... $items) : Set
    {
        $values = $this->_removeSameAll($items);
        $this->setValues($values);
        return $this;
    }