messages departments section

This commit is contained in:
amazuecos
2025-03-20 08:20:50 +01:00
parent d417db18e2
commit 6e96beeec8
26 changed files with 1045 additions and 306 deletions

View File

@ -108,7 +108,7 @@ class ChatDeparmentModel extends Model
public function getChatDeparmentUserQuery(int $chat_deparment_id)
{
$query = $this->builder()
$query = $this
->select(
[
"users.*"
@ -123,20 +123,21 @@ class ChatDeparmentModel extends Model
"users",
"chat_department_users.user_id = users.id",
'left'
)->where("chat_departments.id", $chat_deparment_id)
->where("chat_department_users.deleted_at", null)
->where("users.deleted_at", null);
)
->where("chat_department_users.chat_department_id", $chat_deparment_id)
->where("chat_department_users.deleted_at",null)
->where("users.deleted_at",null);
return $query;
}
public function getChatDepartmentUsers(int $chat_deparment_id)
{
$result = $this->getChatDeparmentUserQuery($chat_deparment_id)
->where('chat_department_users.presupuesto_id', null)
->where('chat_department_users.pedido_id', null)
->where('chat_department_users.factura_id', null)
->get()->getResultObject();
return $result;
->where('chat_department_users.presupuesto_id',null)
->where('chat_department_users.pedido_id',null)
->where('chat_department_users.factura_id',null)
->get();
return $result->getResultObject() ?: [];
}
public function getChatDeparmentPresupuestoUsers(int $chat_deparment_id, int $presupuesto_id)
{
@ -163,7 +164,7 @@ class ChatDeparmentModel extends Model
{
return $this->find($chat_deparment_id)->display;
}
public function getChatDepartmentSelect(string $query = null)
public function getChatDepartmentSelect(?string $query)
{
$q = $this->builder()->select([
"id",
@ -176,4 +177,8 @@ class ChatDeparmentModel extends Model
}
return $q;
}
public function datatableQuery()
{
return $this->select(['id','display','description'])->where('deleted_at',null);
}
}