-1
This serves for me to report through a timestamp in the column dating if my data has any modification.
foreach ($lista_cnae as $cnpj => $lista) {
$lista = "'" . implode("','", $lista) . "'";
$stmt = $pdo->prepare("UPDATE cnaes_secundarios SET data_remocao = now() WHERE cnpj=:cnpj AND cnae NOT IN($lista) AND data_remocao IS NULL");
$stmt->execute([
'cnpj' => $cnpj,
]);
}
What models will you use and what SQL does?
– Woss
I have a table where I do Insert and update and if the information has any changes like for example an update I inform to my removal column that that data was modified through a timestamp().
– KALIBBAN
If you are using Eloquent, it would not be enough to create Models using soft delete?
– Woss
What is your doubt? is to do the
Model
?– novic
My doubt and how to create this query in Laravel.
– KALIBBAN