public function beforeSave($insert) { $this->profit = (int) $this->profit === 0 ? 0 : $this->profit; $this->purchaseprice = (int) $this->purchaseprice === 0 ? 0 : $this->purchaseprice; $this->saleprice = (int) $this->saleprice === 0 ? 0 : $this->saleprice; if ($this->isNewRecord) { $this->created = new \yii\db\Expression('NOW()'); } else { $this->modified = new \yii\db\Expression('NOW()'); } return parent::beforeSave($insert); }
public function beforeSave($insert) { if ($insert) { $this->created = new \yii\db\Expression('NOW()'); } else { $this->modified = new \yii\db\Expression('NOW()'); } return parent::beforeSave($insert); }
public function beforeSave($inseret) { if ($this->isNewRecord) { $this->dateDBformat = false; } if ($this->reg_date == null) { $this->reg_date = $this->writeDate('now'); } return parent::beforeSave($inseret); }