/** * Deletes an existing Note model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param $id * @return \yii\web\Response * @throws ForbiddenHttpException * @throws NotFoundHttpException * @throws \Exception */ public function actionDelete($id) { $model = $this->findModel($id); if (Access::checkIsCreator($model)) { $model->delete(); return $this->redirect(['index']); } throw new ForbiddenHttpException("Not allowed delete note other user"); }