public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->isNewRecord) { $this->author = \Yii::$app->user->identity->id; $this->create_date = time(); } else { $this->author=\Yii::$app->user->identity->id; $this->update_date=time(); } } return true; }
No comments:
Post a Comment