Problem creating logs

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

for those who require the code to generate logs I leave it below

            $modellogs = new Logs();
            $modellogs->id_update = $model->id;
            $modellogs->tabla = $model->tableName();
            $modellogs->usuario = Yii::$app->user->identity->user_id;
            $modellogs->descripcion = "ActualizaciĆ³n " . " " . $model->id . " " . $model->descripcion;
            $modellogs->accion = "update";
            $modellogs->save();

make appropriate adjustments depending on what they need to store in logs