Хочу удалить запись из таблицы бд
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
экшн в контроллере
/**
* Deletes an existing ConsSubcategoryForm model.
* If deletion is successful, the browser will be redirected to the 'competence' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
* @throws \Throwable
* @throws \yii\db\StaleObjectException
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['competence']);
}
/**
* Finds the ConsSubcategoryForm model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return ConsSubcategory the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = ConsSubcategory::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
не происходит редирект обратно на "competence", а идет на страницу "delete", соответственно кидает ошибку 403