Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function actionUpdate($id) {
- $model = $this->findModel($id);
- if ($model->load($_POST) && $model->save()) {
- return $this->redirect(['view', 'id' => $model->id]);
- } else {
- return $this->render('update', [
- 'model' => $model,
- ]);
- }
- }
- public function beforeSave($insert) {
- if ($this->isAttributeChanged('name')) {
- rename($this->getOldAttribute('name') . '.pdf', $this->name . '.pdf');
- }
- parent::beforeSave($insert);
- }
- public function beforeSave() {
- if ($this->isNewRecord) {
- $this->insertDate = new CDbExpression('NOW()');
- } else {
- $this->updateDate = new CDbExpression('NOW()');
- }
- return parent::beforeSave();
- }
- public function beforeSave() {
- $this->date = date('Y-m-d', $this->date);
- return parent::beforeSave();
- }
Add Comment
Please, Sign In to add comment