Answer the question
In order to leave comments, you need to log in
How to remove deletion error?
$del = Yii::$app->request->get('del');
if (!empty($del)) {
$del_org = Comments::findOne($del);
$del_org->delete();
Answer the question
In order to leave comments, you need to log in
Try like this:
$del = Yii::$app->request->get('del');
if (!empty($del)) {
$del_org = Comments::findOne($del);
if ($del_org->delete()) {
$this->redirect(...url...); // Это работает в контроллере
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question