Exemplo n.º 1
0
 /**
  * Updates an existing AssignRole model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $old_parents = $model->parents;
         if ($model->save()) {
             MyModel::updateChildParents($model, $old_parents);
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }
Exemplo n.º 2
0
 /**
  * Deletes an existing Skill model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = $this->findModel($id);
     MyModel::deleteFile($model->image);
     $model->delete();
     return $this->redirect(['index']);
 }