Answer the question
In order to leave comments, you need to log in
How to remove 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
Because in CRUD it is worth deleting only by the POST method (look at the generator example, you can see in what format the link should be in order to delete the request). This is made from CSRF attacks.
What to do?
1) Or follow only the link that makes an AJAX delete request (see the standard code after the generator)
2) Remove the behavior VerbFilter, but this is very undesirable, as it reduces the security of the application
You only have post permission for deletion, so links should send a post request.
If you do it through get, then the first search engine will delete everything nafig, as it will follow these links. (if there is open access)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question