I would like to know how could I use str_replace in this function... I tried like this.. but didn't work, can somebody help me?
public function onRow(Row $row)
{
$row = $row->toArray();
$incidencias = Incidencias::firstOrCreate([
'id_incidencia' => $row['id_de_la_incidencia']
],
[
'id_incidencia' => $row['id_de_la_incidencia'],
'nro_ticket' => $row['nro_ticket_ttcttg'],
'nro_cabec' => $row['nro_cabecera'],
'nro_ticket_prov' => str_replace('°', '', $row['n_ticket_proveedor']),
'nro_loc' => $row['numero_local_del_contacto_directo'],
'org_cont' => $row['organizacion_del_contacto_directo'],
'org_cierre' => $row['origen_del_cierre'],
]
);
if(!$incidencias->wasRecentlyCreated) {
$incidencias->update([
'id_incidencia' => $row['id_de_la_incidencia'],
'nro_ticket' => $row['nro_ticket_ttcttg'],
'nro_cabec' => $row['nro_cabecera'],
'nro_ticket_prov' => str_replace('°', '', $row['n_ticket_proveedor']),
'nro_loc' => $row['numero_local_del_contacto_directo'],
'org_cont' => $row['organizacion_del_contacto_directo'],
'org_cierre' => $row['origen_del_cierre'],
]);
}
}
This is the solution to non digite characters
preg_replace('~\D~', '', $str);