public function beforeSave($insert) { if ($this->show == 1 && isset($this->oldAttributes['show'])) { $this->posted = date('Y-m-d H:i:s'); } return parent::beforeSave($insert); }
public function beforeSave($insert) { if (!parent::beforeSave($insert)) { return false; } $this->content = PostService::contentTweet($this->content, $this); return true; }
public function beforeSave($insert) { $this->author = isset(\Yii::$app->user->identity['id']) ? \Yii::$app->user->identity['id'] : 0; return parent::beforeSave($insert); }
public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($insert) { $this->last_comment_time = $this->created_at; } return true; } else { return false; } }
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; } }