public function beforeSave($insert) { parent::beforeSave($insert); $this->historyTemp = new History(); $this->historyTemp->attributes = ['title' => $this->title, 'content' => $this->content, 'user_id' => 1]; $this->content = Markdown::process($this->content, 'gfm'); if (!$this->isNewRecord) { $this->historyTemp->renderDiff($this->lastEdit); } return true; }