findGroupUser($userId, $groupId); if ($record && $record->blocked == 0) { throw new BadRequestException('im_chat_group_user.has_joined'); } } public function checkIfBlocked($userId, $groupId) { $repo = new ImChatGroupUserRepo(); $record = $repo->findGroupUser($userId, $groupId); if ($record && $record->blocked == 1) { throw new BadRequestException('im_chat_group_user.blocked'); } } }