/** * Called every time a member is added/removed from a team * * @param TeamAbandonEvent|TeamJoinEvent|TeamKickEvent $event The event * @param string $type The type of the event */ public function onTeamMembershipChange(Event $event, $type) { $query = \Conversation::getQueryBuilder()->forTeam($event->getTeam()); foreach ($query->getModels() as $conversation) { \ConversationEvent::storeEvent($conversation->getId(), $event, $type); } }
/** * Called every time a member is added/removed from a team * * @param TeamAbandonEvent|TeamJoinEvent|TeamKickEvent $event The event * @param string $type The type of the event */ public function onTeamMembershipChange(Event $event, $type) { $query = \Conversation::getQueryBuilder()->forTeam($event->getTeam()); foreach ($query->getModels() as $conversation) { \ConversationEvent::storeEvent($conversation->getId(), $event, $type); if ($type === 'team.join') { $conversation->addMember($event->getPlayer(), $distinct = false); } } }