fix chat department message total count

This commit is contained in:
amazuecos
2024-11-13 08:31:27 +01:00
parent e21e790309
commit a285764c2c
3 changed files with 36 additions and 17 deletions

View File

@ -611,5 +611,17 @@ class ChatModel extends Model
return $q->get()->getResultObject();
}
public function getChatDepartmentMessagesCount(int $chat_id,int $chat_department_id) : int
{
$q = $this->builder()->select([
"chat_messages.id"
])
->join("chat_messages","chat_messages.chat_id = chats.id",'left')
->where("chats.chat_department_id",$chat_department_id)
->where("chats.id",$chat_id)
->countAllResults();
return $q;
}
}