Answer the question
In order to leave comments, you need to log in
Why doesn't CRUD remove data from a table?
The data is not deleted.
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
Bad Request (#400)
Failed to validate the submitted data.
Answer the question
In order to leave comments, you need to log in
Good afternoon.
The request must be sent via POST
In the controller, don't forget to include use yii\filters\VerbFilter;
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question