121
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', ['model' => $model,]);
}
}
/**
* Deletes an existing Defect model
* If deletion is successful, the browser will be redirected to the 'index'
page.
* @param integer $id
*
* @return mixed
*/
public function actionDelete($id)
{
Yii::$app->user->identity->accessAdminOnly;
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Defect model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
*
* @return Defect the loaded model
* @throws NotFoundHttpException if the model cannot be found