/** * @inheritdoc */ public function scenarios() { $scenarios = parent::scenarios(); $scenarios['create'] = ['title', 'snippet', 'content', 'preview_url', 'image_url']; $scenarios['update'] = ['title', 'snippet', 'content', 'preview_url', 'image_url']; return $scenarios; }
/** * @inheritdoc */ public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->_createdAtJui) { $this->created_at = Yii::$app->formatter->asTimestamp($this->_createdAtJui); } if ($this->_updatedAtJui) { $this->updated_at = Yii::$app->formatter->asTimestamp($this->_updatedAtJui); } return true; } else { return false; } }