The problem is the following, I'm creating daily OS graphs, only coming from the day bank in English, I would like to replace each index with the Portuguese value My code
public function osSemanal($id_company)
{
$periodo = date("Y-m-d H:i:s", strtotime('-7 days'));
$sql = $this->db->prepare("select DAYNAME(dt_chegada) as dia, count(id) as os_gerada from os where id_company= :id_company
and dt_chegada >= :periodo group by DAYNAME(dt_chegada) order by dt_chegada");
$sql->bindValue(":id_company", $id_company);
$sql->bindValue(":periodo", $periodo);
$sql->execute();
$result = $sql->fetchAll(PDO::FETCH_OBJ);
foreach ($result as $res):
$dados[$res->dia] = $res->os_gerada;
endforeach;
echo json_encode($dados);
}
Comes from the bank:
[0]
"dia"=> "Friday",
"os_gerada"=> 1
[1]
"dia"=> "Sunday",
"os_gerada"=> 4
It is generated:
"Friday" => 1,
"Sunday" => 4
Expected result:
"Sexta" => 1,
"Domingo"=> 4