I have a Laravel application with the following code:
private function todosRegistros($id, $colunas = ['data', 'nivel'])
{
return Leitura::select($colunas)->where('estacao_id', $id);
}
public function _24horas($estacao_id)
{
return $this->todosRegistros($estacao_id)
->where('data', '>', Carbon::now('America/Sao_Paulo')
->subDay())->get();
}
When you run the _24hour method, I get a array
with the level values and the corresponding registration date.
It turns out that the returned date comes in the American format (YYYY-mm-dd)
and would like it to come in the Brazilian format (dd/mm/YYYY)
. Using Carbon::parse
I can change date to date in array
but I would like an alternative where I modify all at once. Does anyone have any idea how to do this?
Thank you.