roles message datatatables

This commit is contained in:
amazuecos
2025-04-03 20:20:36 +02:00
parent 0cde6d5fc5
commit e593f3000b

View File

@ -770,7 +770,7 @@ class ChatModel extends Model
->join("users u", "u.id = cm.sender_id", 'left')
->where("chats.presupuesto_id is NOT NULL", NULL, FALSE);
if (auth()->user()->inGroup("admin") == false) {
if (auth()->user()->inGroup("cliente-administrador","cliente")) {
$query->where('presupuestos.cliente_id', auth()->user()->cliente_id)
->where("chats.chat_department_id is NOT NULL", NULL, FALSE);
}
@ -801,7 +801,7 @@ class ChatModel extends Model
->join("presupuestos", "presupuestos.id = pedidos_linea.presupuesto_id", 'left')
->where("chats.pedido_id is NOT NULL", NULL, FALSE);
if (auth()->user()->inGroup("admin") == false) {
if (auth()->user()->inGroup("cliente-administrador","cliente")) {
$query->where('presupuestos.cliente_id', auth()->user()->cliente_id)
->where("chats.chat_department_id is NOT NULL", NULL, FALSE);
}
@ -831,12 +831,10 @@ class ChatModel extends Model
->join("facturas", "facturas.id = chats.factura_id", "left")
->where("chats.factura_id is NOT NULL", NULL, FALSE);
if (auth()->user()->inGroup("admin") == false) {
if (auth()->user()->inGroup("admin") == false) {
if (auth()->user()->inGroup("cliente-administrador","cliente")) {
$query->where('facturas.cliente_id', auth()->user()->cliente_id)
->where("chats.chat_department_id is NOT NULL", NULL, FALSE);
}
}
return $query->groupBy('chatMessageId');
}
public function createNewDirectChat(string $title, string $message, array $users)