Good evening
I need your help, what happens is that I need to generate a log of the actions that users do, I already have the table with the logs, but at the time of doing the code in yii2 in the create controller of the model I need to do log generates error, I put the code that I have used so far
if ($model->save()) {
if($model->isNewRecord){
$modellogs = new Logs();
$modellogs->id_update=$model->id;
$modellogs->tabla = 'qhse_accidentes';
$modellogs->usuario = "1";
$modellogs->descripcion = $model->descripcion;
$modellogs->accion = "create";
}
else {
print_r($modellogs);
print_r($modellogs->errors);
}
I am putting the log model data in an if that tells me if it is a new record of the main model, save that data but it is not storing it in the table
I appreciate help in advance