I am having some problems with the queries in the ORM-Eloquent, I have integrated eloquent in codeigniter, I am trying to make the following query:
SELECT tp.*, COUNT(*) as cuenta
FROM tipo_llamadas tp
INNER JOIN encuestas e ON tp.id = e.id_tipo_llamada
WHERE e.id_oleada = 1
GROUP BY tp.id
The result is the following:
id | nombre | cuenta
---------------------------
1 | Información | 3
2 | Recogida | 1
But I can not get it out, I have taken the following query, but I need to get the INNER JOIN
with tipo_llamadas
to get their names:
Encuesta::selectRaw('*, count(*) as cuenta')
->groupBy('id_tipo_llamada')
->get()
->toArray();