Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public function beforeSave($insert)
 {
     if (!parent::beforeSave($insert)) {
         return false;
     }
     $this->content = PostService::contentTweet($this->content, $this);
     return true;
 }
Ejemplo n.º 3
0
 public function beforeSave($insert)
 {
     $this->author = isset(\Yii::$app->user->identity['id']) ? \Yii::$app->user->identity['id'] : 0;
     return parent::beforeSave($insert);
 }
Ejemplo n.º 4
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if ($insert) {
             $this->last_comment_time = $this->created_at;
         }
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 5
0
 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;
     }
 }