127
}
}
/**
* Deletes an existing Request 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);
if (Yii::$app->user->identity->IsAdmin == false)
{
throw new UserException ('Закрытую заявку может
удалить только администратор');
}
$model->delete();
return $this->redirect(['index']);
}
/**
* Finds the Request model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Request the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{