diff --git a/controllers/ListController.php b/controllers/ListController.php index 633ca1b..1fa8936 100644 --- a/controllers/ListController.php +++ b/controllers/ListController.php @@ -83,4 +83,14 @@ class ListController extends \yii\web\Controller $param->save(); return $this->redirect('/list?ParameterSearch[id]='. $id); } + + public function actionDel(Request $request) + { + $id = $request->getQueryParam('id'); + $param = ParameterSearch::find()->where([ 'id'=> $id ])->one(); + if ($param !== null) { + $param->delete(); + } + return $this->redirect('/list'); + } } diff --git a/views/list/index.php b/views/list/index.php index 0fc6368..e4a4ff7 100644 --- a/views/list/index.php +++ b/views/list/index.php @@ -68,7 +68,8 @@ $this->title = 'params list'; [ 'label' => 'Edit', 'value' => function (Parameter $model) { - return Html::a('Edit', '/list/edit?id=' . $model->id, [ 'class' => 'btn btn-sx btn-secondary' ]); + return Html::a('Edit', '/list/edit?id=' . $model->id, [ 'class' => 'w-100 btn btn-sx btn-secondary' ]) . + Html::a('Delete', '/list/del?id=' . $model->id, [ 'class' => 'w-100 btn btn-sx btn-danger' ]); }, 'format' => 'raw', ],