Closed AnasShafqat closed 5 years ago
Timestamp fields are populating automatically:
in controller.php:
actionCreate() {
$model->created_by = Yii::$app->user->identity->id;
$model->created_at = new \yii\db\Expression('NOW()');
$model->updated_by = '0';
$model->updated_at = '0';
$model->save();
}
----------------------------------------------------------------------------------------------
actionUpdate(){
$model->updated_by = Yii::$app->user->identity->id;
$model->updated_at = new \yii\db\Expression('NOW()');
$model->created_by = $model->created_by;
$model->created_at = $model->created_at;
$model->save();
}
Timestamp is required for the following fileds