/** * Deletes an existing Employee 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); //remove upload file & data $this->removeUploadDir($model->token_forupload); Uploads::deleteAll(['ref' => $model->token_forupload]); // remove resume file $resume = Employee::getResumePath() . '/' . $model->resume; @unlink($resume); $model->delete(); return $this->redirect(['index']); }
/** * Deletes an existing Album 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); //remove upload file & data $this->removeUploadDir($model->ref); Uploads::deleteAll(['ref' => $model->ref]); $model->delete(); return $this->redirect(['admin']); }
/** * Deletes an existing Article model. * If deletion is successful, the browser will be redirected to the 'index' page. * * @param integer $id * @return mixed * * @throws NotFoundHttpException */ public function actionDelete($id) { $model = $this->findModel($id); if (Yii::$app->user->can('deleteArticle', ['model' => $model])) { // Check permission before process acction //remove upload file & data $this->removePhotosUploadDir($model->ref); Uploads::deleteAll(['ref' => $model->ref]); $model->delete(); return $this->redirect(['index']); /* $this->findModel($id)->delete(); return $this->redirect('index.php?r=article/admin'); */ } else { throw new ForbiddenHttpException('ขอแสดงความเสียใจอย่างสุดซื้ง!, คุณไม่ได้รับอนุญาตให้เข้าใช้งาน'); } }