public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
if ($this->tags) {
$this->addTags(explode(',', $this->tags));
}
$this->content = TopicService::contentTopic($this->content, $this) . ($this->cc ? t('app', 'cc {username}', ['username' => Yii::$app->user->identity->username]) : '');
if ($insert) {
$this->user_id = $this->user_id ?: Yii::$app->user->id;
$this->type = self::TYPE;
$this->last_comment_time = $this->created_at;
}
return true;
} else {
return false;
}
}