public function beforeSave($insert) { if ($insert) { $this->upid = yii::$app->request->post('parentKey', 0); $this->url = rtrim($this->url); $this->upid = $this->upid == 'root' ? 0 : $this->upid; } return parent::beforeSave($insert); }
/** * @inheritdoc */ public function beforeSave($insert) { if (parent::beforeSave($insert)) { $this->id_student = Yii::$app->session['id_student']; $this->collapsed = 1; return true; } else { return false; } }