Answer the question
In order to leave comments, you need to log in
Yii2 actionDelete method not working, why?
How to delete in CRUD?
I go to the admin panel, shows a list from the database. View works update works, I click on fish and bad request (#400) pops up WHY ?
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
Answer the question
In order to leave comments, you need to log in
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST','GET'],
],
] ,
];
}
Bad Request (#400): Unable to verify your data submission Indicates
that you are sending a post request that does not contain a csrf token. It is necessary to either disable the check or add it to the request
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question