public function beforeSave($insert) { if (empty($this->parent)) { $this->parent = 0; } return parent::beforeSave($insert); }
public function beforeSave($insert) { parent::beforeSave($insert); $this->url_code = \app\common\XUtils::shorturl($this->url); $this->description = \app\common\XUtils::ihtmlspecialchars($this->description); !$this->id && ($this->createtime = time()); $this->updatetime = time(); return true; }
/** * This is invoked before the record is saved. * @return boolean whether the record should be saved. */ public function beforeSave($insert) { if (parent::beforeSave($insert)) { if ($this->isNewRecord) { $this->create_time = date("Y-m-d H:i:s", time()); $this->author_id = Yii::$app->user->id; } return true; } else { return false; } }
/** * 入库前自动处理 */ public function beforeSave($insert) { parent::beforeSave($insert); if (trim($this->password)) { $this->password = md5($this->password); } if (!$this->id) { $this->create_time = time(); $this->last_login_time = time(); } return true; }
public function beforeSave() { $this->aBeforeSave(); $this->tsBeforeSave(); parent::beforeSave(); }