fix : mensajes internos, arreglar total numero mensajes

This commit is contained in:
amazuecos
2024-11-13 00:47:47 +01:00
parent b97e027920
commit eb604f3293
8 changed files with 64 additions and 30 deletions

View File

@ -599,6 +599,17 @@ class ChatModel extends Model
$userModel = model(UserModel::class);
return $userModel->find($first_message->sender_id);
}
public function getOpenChatCliente(int $user_id) : array
{
$q = $this->builder()->distinct()->select([
"users.*"
])
->join("chat_messages","chat_messages.chat_id = chats.id","left")
->join("users","users.id = chat_messages.sender_id","left")
->where("chat_messages.receiver_id",$user_id);
return $q->get()->getResultObject();
}
}