feat: delete param
This commit is contained in:
parent
58d0edb8fc
commit
d87571171c
|
@ -83,4 +83,14 @@ class ListController extends \yii\web\Controller
|
||||||
$param->save();
|
$param->save();
|
||||||
return $this->redirect('/list?ParameterSearch[id]='. $id);
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,8 @@ $this->title = 'params list';
|
||||||
[
|
[
|
||||||
'label' => 'Edit',
|
'label' => 'Edit',
|
||||||
'value' => function (Parameter $model) {
|
'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',
|
'format' => 'raw',
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue