Hi how to convert this query to laravel ORM, or Eloquent? And the oy field now returns number of month, i want to get name of month.
SELECT c.name as company, i.title_uz as internet, EXTRACT(MONTH FROM ci.created_at) as oy, COUNT(*) AS miqdor
FROM count_internets AS ci
JOIN companies as c ON ci.company_id = c.id
JOIN internets as i ON ci.u_id = i.id
GROUP BY company, internet, oy
for month name, you can use MySQL MONTHNAME() Function
DB::table("count_internets")->join("companies","companies.id",'=','count_internets.company_id')
->join("internets",'internets.id','=','count_internets..u_id')
->select(["count_internets.name as company",'internets.title_uz as internet',DB::raw("MONTHNAME(companies.created_at) as oy")
,DB::raw("COUNT(*) AS miqdor")])
->groupBy(['company','internet','oy'])->get();